you can create a custom shortcut with a non-executable bash script but it will not function. maybe the add command dialogue should warn the user when they attempt this. or it should cause an error when they try to use the shortcut to help them identify the issue.
Interesting idea. There’s no ‘but’ in there. If you want your bash script to give some output, then you’d need to channel it to your GUI.
Maybe try this:
#!/usr/bin/env bash
amixer set Master 80%
I choose this because the volume control notification shows up when I execute this (via mouse gesture).
Now, as it’s not executable - you can also try in a terminal, and as you have not made it executable it won’t work:
fish: Unknown command. 'v8.sh' exists but is not an executable file.
So then you know you have to do:
chmod +x v8.sh
If that file exists in your $PATH, then it can be executed via krunner.
You could rename that to ‘v8’ and run ‘v8’ from krunner and you could run it through a binding.
#!/bin/bash
# Check if the script is executable
if [ ! -x "$0" ]; then
kdialog --msgbox 'This script won't work - chmod +x $0' to make it executable."
exit 1
fi
haha, the problem here is that the solutions are just far more complicated than the issue.
I think it’s a bit like you pressing Shift_V instead of Ctrl_V on the keyboard, then you want your computer to warn you that you’re pressing the wrong key.
I have one or two scripts which pipe useful outputs to kdialog to confirm execution (like backing up bitwarden) but I don’t really have built-in error correction.
Perhaps if you shared more information - like what the actual script was, what you were trying to do, then it’d be more productive.
As a general rule, if someone makes a script, it’s not the job of the custom shortcuts to work out if it will work or not… though custom shortcuts can warn you if your chosen shortcut clashes with another existing shortcut.
That means if you bind a command to launch strawberry, then remove strawberry, it just executes and there’s no strawberry.