From copyq-scripting
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.
npx claudepluginhub danielrosehill/claude-code-plugins --plugin copyq-scriptingThis skill uses the workspace's default tool permissions.
There are two viable approaches. Pick based on context:
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
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.
GlobalShortcutAdd 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)"
# Then press the keybind in any focused app.
Bind the shortcut at the DE level via kglobalaccel / System Settings, pointing at a copyq CLI call.
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()));' |
# Create a desktop-action file that calls copyq
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.
Settings → Keyboard → View and Customize Shortcuts → Custom Shortcuts → +. Set Command to the same copyq ... invocation.
Add to config:
bindsym $mod+v exec copyq menu
bindsym $mod+Shift+v exec copyq eval -- 'copy(str(clipboard())); paste();'
// Paste-as-plain-text
copy(str(clipboard())); paste();
// Strip URL tracking params from clipboard then paste
var t = str(clipboard()).replace(/([?&])(utm_[^=&]+|fbclid|gclid)=[^&]*/g, '$1').replace(/[?&]$/, '');
copy(t); paste();
// Insert a templated snippet
copy('Best regards,\nDaniel'); paste();
// Push current clipboard to a "Saved" tab without disturbing focus
tab('Saved'); add(str(clipboard()));
After binding, test by focusing a text editor and pressing the key. If nothing happens:
pgrep -a copyq).kglobalaccel5 --list on KDE).