I have a bash script on my desktop called
Currently, if I want to execute it, I open a terminal and type
./script.sh, and if I want to stop it, I have to press Ctrl + C
What I'd like to do is bind the script to a key, let's say 7 for example, so that if the script is off, and I press 7, it's turned on, and if it's already on, and I press 7, it's turned off.
I already know how to bind it in keyboard shortcuts to turn it on, but the problem is that pressing the shortcut again only creates another instance of the script, which isn't what I want.