On Ubuntu 20.04, I want to switch to the workspace above by just pressing the CapsLock key. However, the following does not work:
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up ['capslock']
Neither can I do it from the GUI, because in Settings, CapsLock is not recognized. But anyway, my need is to be able to do it from the command line.
How to, pls?
You indeed cannot bind modifier keys to a command. However, the tool
xcape
can remap hitting and releasing a modifier key to a keyboard combination.Thus,
would make you switch to the next workspace by hitting and releasing CapsLock, because Super+PgDn is a default existing keybinding to move to the next workspace.
uNFORTUNATELLY, THAT CHANGES THE cAPSLOCK sTATE EACH TIME.
To avoid that, one trick is to fisrt remap CapsLock to Hyper, which is not present on common keyboards using the xkb options. You can do this using Gnome Tweaks on the "Keyboard & Mouse" tab. Then, next command will do the trick: