Updates from Ricky Lindén

How to fix Gnome's virtual desktops on Ubuntu 20.04

[linkstandalone]

When it comes to using Gnome as a desktop environment on Linux it has a very specific workflow in mind. You can still make some changes, but sometimes simply changing keyboard shortcuts through GUI does not work for certain key combinations. One such situation in the Gnome version that ships with Ubuntu 20.04 is switching workspace (or virtual desktop as Gnome calls them).

If you do not like adding workspaces as you go, but prefer the tiling window manager way of dealing with workspaces (having nine fixed workspaces for specific programs/use cases), read on.

This has worked for me, without breaking anything, but obviously your mileage may vary, so please take a backup first with for instance Timeshift or rsync.

The solution is based on user jabirali's comment on an open issue on Pop_OS! GitHub-page. So, what you need to do:


1. Set a static number of workspaces to 9:

gsettings set org.gnome.mutter dynamic-workspaces false

gsettings set org.gnome.desktop.wm.preferences num-workspaces 9


2. Then unbind all the Gnome default keybindings for switching between applications:

gsettings set org.gnome.shell.keybindings switch-to-application-1 []

gsettings set org.gnome.shell.keybindings switch-to-application-2 []

gsettings set org.gnome.shell.keybindings switch-to-application-3 []

gsettings set org.gnome.shell.keybindings switch-to-application-4 []

gsettings set org.gnome.shell.keybindings switch-to-application-5 []

gsettings set org.gnome.shell.keybindings switch-to-application-6 []

gsettings set org.gnome.shell.keybindings switch-to-application-7 []

gsettings set org.gnome.shell.keybindings switch-to-application-8 []

gsettings set org.gnome.shell.keybindings switch-to-application-9 []


3. Rebind them to switch between workspaces on Super + number:

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['1']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-2 "['2']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-3 "['3']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-4 "['4']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-5 "['5']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-6 "['6']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-7 "['7']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-8 "['8']"

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-9 "['9']"


4. In addition, it's convenient to have Super + Shift + number move a window between workspaces:

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-1 "['1']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-2 "['2']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-3 "['3']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-4 "['4']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-5 "['5']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-6 "['6']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-7 "['7']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-8 "['8']"

gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-9 "['9']"