Bug 508069

Summary: KSystemClipboard on Gnome/Wayland
Product: [Frameworks and Libraries] frameworks-kguiaddons Reporter: Jeremy <borgman.jeremy>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: REPORTED ---    
Severity: normal CC: sandro.jaeckel
Priority: NOR    
Version First Reported In: 6.17.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jeremy 2025-08-10 00:32:52 UTC
SUMMARY
Flameshot uses KSystemClipboard provided by KGuiAddons. After porting to Qt6 our clipboard functionality stopped working on gnome + wayland. This error is reported:

```
kf.guiaddons: Could not init WaylandClipboard, falling back to QtClipboard.
```

I then wrote a very minimal working example to demonstrate this bug. If this code is executed on Gnome + Wayland the same error is printed to the terminal. Unfortunately falling back to QtClipboard does not work on gnome + wayland. Is this user error on my part with how we are using the clipboard or is there an underlying issues?

Note, this did not happen before our Qt6 port. 

```
#include <QApplication>
#include <KSystemClipboard>
#include <QDebug>
#include <QGuiApplication>

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    auto clipboard = KSystemClipboard::instance();
    if (!clipboard) {
        qDebug() << "Failed to get KSystemClipboard instance";
        return 1;
    }

    qDebug() << "KSystemClipboard initialized successfully";
    return 0;
}
```

STEPS TO REPRODUCE
1. Compile minimal example shown above
2. See that the error is printed when run on gnome + wayland

OBSERVED RESULT
Error is reported and Qtclipboard is used as a fallback. 

EXPECTED RESULT
No error is reported and clipboard

SOFTWARE/OS VERSIONS
Arch linux, Gnome, wayland