Bug 388350

Summary: Custom shortcuts and krunner do not work with scripts without shebang
Product: [Applications] systemsettings Reporter: Alexander <ashaduri>
Component: kcm_khotkeysAssignee: Michael Jansen <kde>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: kdelibs-bugs-null
Priority: NOR    
Version First Reported In: 5.20.3   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alexander 2017-12-30 10:59:19 UTC
Since upgrading to KDE frameworks 5.41 (from 5.38 I think?) custom shortcuts don't work when the "Action" points to a shell script.

To test:
I created a new custom shortcut, assigned Meta-Z to it, and wrote "/usr/local/bin/test_shortcut" as its Action.

/usr/local/bin/test_shortcut contains:
---------------------
#!/bin/bash
/usr/bin/kwrite
---------------------

Pressing Meta-Z (Win-Z) doesn't do anything except maybe flickering the active window titlebar.
Running the shell script directly runs kwrite.
Putting "/usr/bin/kwrite" into the Action field works, it runs kwrite.

Thanks
Comment 1 Alexander 2017-12-30 11:21:55 UTC
Upon further investigation, I have to correct the report.

Basically, the shortcuts fail only if the shell script doesn't have "#!/bin/bash" in the beginning. This used to work in older versions.
They also fail with krunner.
Comment 2 Martin Flöser 2017-12-30 11:54:05 UTC
Reassigning to khotkeys as this provides the "custom shortcuts".
Comment 3 Christoph Feck 2018-01-10 15:14:50 UTC
I doubt that 'khotkeys' looks at the contents of the assigned scripts. I have no idea where to reassign to, though.
Comment 4 Nate Graham 2024-03-04 19:41:54 UTC
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.