hluk / hluk/CopyQ

[Bug] Internal global shortcuts fail to trigger on KDE Plasma Fedora 43 / Wayland

Open
#3,488 6 comments 1 reaction 0 assignees View on GitHub
bug Wayland
Dominant language
C++
Stars
12.3k
Forks
593
Avg merge
2d 8h
Merged PRs (30d)
9

Description

### **Environment:**
* **OS / Desktop Environment:** fedora plasma 43(QDBUS6)
* **Windowing System:** Wayland
* **CopyQ Version:** 13.0.0
* **System Language:** EN

### **Description:**
When setting a global shortcut directly through CopyQ's internal `Preferences -> Shortcuts` menu, the shortcut fails to trigger the CopyQ panel under KDE Plasma Wayland.

To work around this, users normally map a KDE Custom Shortcut to `/usr/bin/copyq toggle`. However, **this also fails silently** on Plasma 6 Wayland. It appears KDE's shortcut daemon (`kglobalacceld`) runs commands in a stripped environment, causing Qt/CopyQ to fail to launch or communicate with the daemon. It only works if wrapped in a bash script that explicitly forces Wayland variables.

*Note: Running `copyq toggle` manually in Konsole works.*

### **Steps to Reproduce:**
**Test 1 (Internal Shortcut):**
1. Open CopyQ -> `File` -> `Preferences` -> `Shortcuts`.
2. Assign a shortcut to "Show main window under mouse cursor" (e.g., `Meta+V`).
3. Press the shortcut. **Result:** Fails to show.

**Test 2 (KDE Custom Command directly):**
1. Clear the CopyQ internal shortcut.
2. Go to KDE `System Settings -> Keyboard -> Shortcuts -> Add Custom Command`.
3. Set the command to `/usr/bin/copyq toggle` and assign the shortcut.
4. Press the shortcut. **Result:** Fails to show.

### **Logs / Error Output:**
When redirecting the output of the KDE Custom Command shortcut to a log, it reveals that the KDE shortcut runner is stripping the locale and environment:
```text
XDG_SESSION_TYPE=wayland
WAYLAND_DISPLAY=wayland-0
DISPLAY=:0
XDG_RUNTIME_DIR=/run/user/1000
Attempting to toggle CopyQ...
Warning: [default] Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
Warning: Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
true
Command finished with exit code: 0
```
*(Even though it outputs `true` and exit code `0`, the window never actually renders on screen unless wrapped).*

### **The Only Working Workaround:**
To actually get the window to toggle via a shortcut, I had to create a bash script (`copyq_toggle.sh`) that manually forces the Qt platform:
```bash
#!/bin/bash
export QT_QPA_PLATFORM=wayland
/usr/bin/copyq toggle
```
Then, map the KDE Custom Shortcut to execute: `bash /path/to/copyq_toggle.sh`

### **Expected Behavior:**
1. CopyQ's internal shortcut registration should successfully trigger the Wayland window via the desktop portal.
2. If that's a KDE Wayland limitation, `copyq toggle` should gracefully handle being launched from a stripped `kglobalacceld` environment without requiring a bash wrapper script.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.