Ubuntu – Command run in terminal, not with shortcuts

command linemateshortcut-keysworkspaces

As explain in this thread, I want to add shortcuts to switch workspaces (in Mate).

I found a way to switch workspace for the terminal: wmctrl -s $(wmctrl -d | grep "*" | awk '{print $1+1}').

But this command line does not work when I add it in the shortcut manager. Does any one know why ?

Best Answer

IIRC keyboard shortcut commands are running in an sh shell, which doesn't have all the features Bash has.

Your command uses some bash-specific syntax though, which is why it doesn't work. The simplest fix is to simply run it in a Bash shell by replacing it with this command below:

bash -c "wmctrl -s $(wmctrl -d | grep '*' | awk '{print $1+1}')"
Related Question