5

I currently use shortcuts Super+F1 to Super+F6 to switch over my six workspaces. It was possible in Ubuntu 16.04 (System -> Keyboard -> Navigation) but in 18.04, we can define shortcuts for only 4 wokspaces by default.

How can I increase this default workspaces number in shortcuts parameters ?

pomsky
  • 68,507

2 Answers2

9
  1. First, you will need to increase the number of static workspaces. You can do that on the "Workspaces" tab in GNOME Tweaks (not installed by default). You can also use the terminal to change that configuration:

    gsettings set org.gnome.mutter dynamic-workspaces false
    gsettings set org.gnome.desktop.wm.preferences num-workspaces 6
    

    These commands disable dynamic workspaces, and set the number of workspaces to 6.

  2. You then can set hotkeys to switch to any workspace including workspaces higher than four, using dconf-editor, or, much more convenient in this case, using the terminal.

    gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-5 "['<Super>5']"
    gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-5 "['<Super><Shift>5']"
    

    These two comments will set up Super+5 to move to workspace 5, and Super+Shift+5 to move a window to workspace 5. Replace workspace-5 by workspace-6 and higher to set for higher

pomsky
  • 68,507
vanadium
  • 88,010
  • It works fine, I only replace "['5']" by "['F5']" to use function keys. Thanks a lot !!! – Loranger Dec 10 '19 at 09:30
  • Yes, sorry, I just copied the commands as how I have once set it up. Super+number is the keybinding used by i3 desktop. But indeed, anyone can adapt to preference. – vanadium Dec 10 '19 at 11:41
  • 1
    TYSM @vanadium - Works on Ubuntu 20.04.02 LTS "Focal Fossa" – Rob Jun 02 '21 at 06:48
  • 1
    when using 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
0

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.

Pierre D
  • 111
  • 4