I want to map a keyboard key to this command:
wmctrl -a Calculator || gnome-calculator
This works fine when I run it in the terminal, but it doesn't seem to work when I set up a shortcut for this. I'm guessing it doesn't like the ||
.
Specifically, it will focus the calculator if it's already open, but it won't open it if it's not already open (which is what the OR condition is supposed to do).
How can I work around this?
I don't think the keyboard shorcuts are ran through bash, so
||
won't work. However, you can do this:-F
means match the full title case-sensitively, and-a
means activate/focus said program,-x
means select by the "WM_CLASS" name which you can get by runningwmctrl -xl
.