SUMMARY If I run the demo script below in a terminal, it works as expected. If I run it triggered by a custom shortcut (configured via settings -> Shortcuts -> Custom Shortcut) it stops after the xsel command and generates no further output. STEPS TO REPRODUCE Make this script in /tmp/ and chmod ug+x : #!/bin/bash rm /tmp/got_here /tmp/xsel.txt > /dev/null 2>&1 xsel -b > /tmp/xsel.txt 2>&1 touch /tmp/got_here OBSERVED RESULT If run from a terminal, /tmp/xsel.txt and /tmp/got_here both appear as expected. If you associate a hotkey to this script via System Settings -> Shortcuts -> Custom Shortcuts -> Edit -> New -> Global Shortcut -> Command/URL (e.g. Action = "/tmp/myscript") and use the hotkey, you will see that /tmp/xsel.txt appears, but /tmp/got_here does not appear. This implies to me that something is crashing, as there is no error output in xsel.txt? EXPECTED RESULT In both cases, /tmp/xsel.txt and /tmp/got_here should appear. If I substitute xclip in place of xsel, it works as expected: both files appear. SOFTWARE/OS VERSIONS Linux/KDE Plasma: 21.04 (also happened in 20.10) KDE Plasma Version: 5.21.4 KDE Frameworks Version: 5.80.0 Qt Version: 5.15.2 I don't see anything obviously awry in journalctl, there is no error in the stdout or stderr in /tmp/xsel.txt, so this seems to fail "silently" which is disturbing, and hence I file this bug report.
As announced in https://pointieststick.com/2023/07/26/what-we-plan-to-remove-in-plasma-6/ and https://community.kde.org/Plasma/Plasma_6#Removals, I'm afraid KHotKeys has reached end-of-life in Plasma 6. Accordingly, all bug reports and feature requests for it must be closed now. Most of what KHotKeys could do can already be done with the newer KGlobalAccel system in Plasma 6. A few features such as mouse gestures and triggering conditions based on changes to window states are not yet implemented in the new system. These will be added in the future if and when resources materialize for them, and/or when a kind soul submits patches to implement them! :) Meanwhile, the 3rd-party "Mouse Actions" app (https://github.com/jersou/mouse-actions) may be usable for implementing your own mouse gestures again. Thanks for your understanding, everyone.
Thanks Nate -- does my description above imply that this is perhaps more likely a bug in xsel? If so, maybe I should post this elsewhere?
Unknown, but it's not something we care about anymore from a KDE perspective. I might recommend asking for help with it on https://discuss.kde.org
This was solved by using the "-o" option with xsel. For more info: https://www.kubuntuforums.net/forum/currently-supported-releases/kubuntu-24-04-nitpick-noble-lts/software-support-bg/681318-strange-xsel-bug-when-run-as-shortcut