Bug 430346 - Custom script as shortcut is not run
Summary: Custom script as shortcut is not run
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_keys (show other bugs)
Version: 5.27.8
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-13 17:32 UTC by lesto
Modified: 2024-08-29 12:55 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lesto 2020-12-13 17:32:36 UTC
SUMMARY
I created a small bash script that mute/unmute my microphone (btw that would be nice to have as default action in kmix).  
The script has execution permission and if i double click it, it runs.  
But if I add the script as shortcut it does not run.  
Also there is no documentation on how some application/script are able to register multiple shortcut withing one executable.
I also tried a smaller script that is only echoing on file on /tmp, and still nothing happen. tried also to reboot

STEPS TO REPRODUCE
1. create a bash script
2. make it executable
3. assign it to a global shortcut
4. try to use the shortcut

OBSERVED RESULT
nothing happen, even after rebooting the system. Other "standard" shortcut, even added later like Firefox to open a new windows, works fine

EXPECTED RESULT
the script would be run
Comment 1 apache 2023-10-12 06:49:04 UTC
I confirm that script that works in terminal, doesn't work when invoked by shortcut added in settings.
Script file it is located:
/home/user_name/script
it starts with #!/bin/sh
I gave it execute privileges.
I went to settings → shortcuts → own shortcuts → new → global → command or url.
I chose shortcut and as action: /home/user_name/./script
When shortcut is pressed nothing happens. 

Operating System: Manjaro Linux 
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.5-1-MANJARO (64-bit)
Graphics Platform: X11
Comment 2 Christoph Cullmann 2024-05-06 18:15:39 UTC
This seems to be not bindings related.
Comment 3 Nate Graham 2024-07-31 04:18:20 UTC
This is using the old unmaintained (and now deleted in Plasma 6.0) KHotKeys system. Is the issue still reproducible with the new global shortcuts system in Plasma 6.0 or later?
Comment 4 Bug Janitor Service 2024-08-15 03:46:58 UTC Comment hidden (spam)
Comment 5 apache 2024-08-15 10:54:36 UTC
In Plasma Version: 6.0.5 when I choose shortcuts add new command or script it doesn't see script files nor any other files only folders, so there is no way to create shortcut in settings. This makes it impossible to verify if this bug is still present unless there is other way to assign shortcut to script.

For example:
#!/bin/sh
kquitapp5 plasmashell && kstart5 plasmashell

still works in plasma 6 and I wanted to assign shortcut to it.

Manjaro Linux 
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.6.44-1-MANJARO (64-bit)
Graphics Platform: Wayland
Comment 6 Nate Graham 2024-08-21 15:44:46 UTC
Does the filename end in ".sh"?`
Comment 7 Nate Graham 2024-08-21 15:52:39 UTC
Git commit ecedd56b3987ecefabfe28b709cadcc115df6b0a by Nate Graham.
Committed on 21/08/2024 at 15:52.
Pushed by ngraham into branch 'master'.

kcms/keys: mention which file types are supported for custom scripts

Otherwise it might not be obvious to the user why their script files
that lack appropriate filename extensions aren't appearing in the
dialog.

M  +1    -1    kcms/keys/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/ecedd56b3987ecefabfe28b709cadcc115df6b0a
Comment 8 apache 2024-08-29 12:06:49 UTC
Sorry for late answer. 
> Does the filename end in ".sh"?`
I didn't. That was the problem. Now on Plasma 6 shortcuts work.
Comment 9 Nate Graham 2024-08-29 12:55:24 UTC
I had a feeling. I've changed the open dialog so it makes the supported filename extensions clear, which should help with this in the future.