| name | bind-global-shortcut |
| description | Bind a system-wide keyboard shortcut to a CopyQ Custom Command — show menu, paste-as-plain-text, run a transformation on the current clipboard, etc. Covers both the in-CopyQ `GlobalShortcut` field and the alternative of binding the shortcut at the desktop-environment level (KDE / GNOME) to a `copyq` CLI invocation. |
Bind a Global Shortcut to CopyQ
There are two viable approaches. Pick based on context:
| Approach | When to use |
|---|
CopyQ's built-in GlobalShortcut | Default. Lives with the command, portable across machines via command export. |
Desktop-environment shortcut → copyq <cli> | Wayland sessions where CopyQ's global shortcut grabber doesn't work, or when the action is a simple CLI call. |
On KDE Plasma 6 / Wayland (the user's setup), CopyQ's built-in global shortcuts can be unreliable because Wayland restricts global key grabbing. Default to the DE-level approach on Wayland unless verified working.
Approach A: CopyQ built-in GlobalShortcut
Add GlobalShortcut to a Custom Command:
[Commands]
1\Name=Paste as plain text
1\GlobalShortcut=ctrl+alt+v
1\Command="
copyq:
var t = str(clipboard());
copy(mimeText, t);
paste();
"
size=1
Or set it in the GUI: Preferences → Commands → (select command) → Global Shortcut.
Verify it works after import:
copyq loadCommands "$(cat shortcut.ini)"
Approach B: KDE Plasma keybinding → CLI
Bind the shortcut at the DE level via kglobalaccel / System Settings, pointing at a copyq CLI call.
Quick way: System Settings → Shortcuts → Custom Shortcuts → New → Global Shortcut → Command/URL
Command examples:
| Action | Command |
|---|
| Show CopyQ menu under cursor | copyq menu |
| Show main window | copyq toggle |
| Paste as plain text | copyq eval -- 'copy(str(clipboard())); paste();' |
| Cycle to previous clipboard item | copyq prev && copyq paste |
| Send selection to a "Snippets" tab | copyq eval -- 'tab("Snippets"); add(str(clipboard()));' |
Scripted way (KDE)
mkdir -p ~/.local/share/applications
cat > ~/.local/share/applications/copyq-paste-plain.desktop <<'EOF'
[Desktop Entry]
Type=Application
Name=CopyQ Paste Plain
Exec=copyq eval -- 'copy(str(clipboard())); paste();'
NoDisplay=true
EOF
Then bind a global shortcut to it via System Settings → Shortcuts → Add Application → pick the entry.
GNOME
Settings → Keyboard → View and Customize Shortcuts → Custom Shortcuts → +. Set Command to the same copyq ... invocation.
i3 / sway
Add to config:
bindsym $mod+v exec copyq menu
bindsym $mod+Shift+v exec copyq eval -- 'copy(str(clipboard())); paste();'
Useful shortcut recipes
copy(str(clipboard())); paste();
var t = str(clipboard()).replace(/([?&])(utm_[^=&]+|fbclid|gclid)=[^&]*/g, '$1').replace(/[?&]$/, '');
copy(t); paste();
copy('Best regards,\nDaniel'); paste();
tab('Saved'); add(str(clipboard()));
Verify a binding
After binding, test by focusing a text editor and pressing the key. If nothing happens:
- Check the CopyQ server is running (
pgrep -a copyq).
- Check no other app is grabbing the shortcut (
kglobalaccel5 --list on KDE).
- On Wayland, fall back to Approach B.