To build upon @vanadium's answer, you also need to remove any conflicting bindings. Otherwise, as I found out, the new keybindings may not work.
For example, I like to use "['<Alt>Fn']" to switch to workspace
n` (1 to 12, one for each function key). But some of these shortcuts conflict with default ones.
Here is how to get the list, as per this answer (in my case of using <Alt>Fn
):
gsettings list-recursively org.gnome.desktop.wm.keybindings | grep '<Alt>F' | grep -v 'switch-to-workspace'
In the default keybindinds, I see e.g. begin-resize
, begin-move
, etc.
Remove those with, e.g.:
gsettings set org.gnome.desktop.wm.keybindings begin-resize "[]"
Then, set all your workspace switching shortcuts at once:
for i in {1..12}; do echo $i; gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-$i "['<Alt>F$i']"; done
Then it all works.
gsettings set ...
, you also need to remove potential conflicts (it seems that, as of Ubuntu 20.04.2 LTS,gsettings
doesn't do that for you). See my supplemental answer. – Pierre D Jul 08 '21 at 14:42