12

I would like to bind both Super+1 and Super+Home as shortcuts to the "Switch to workspace 1" action in GNOME 3. Is there a way to do this?

I think that to achieve this there would either have to be a way to assign multiple keyboard shortcuts to the same action or there would have to be a way to switch workspaces via a command-line action (which would alet me create a shortcut for it in the "custom shortcuts" section). But I'm not sure these are possible...

1

3 Answers 3

13

Yes, this is a dconf setting and the value is an array of strings which means it accepts multiple shortcuts. You can do that via dconf-editor if you navigate to

/org/gnome/desktop/wm/keybindings/switch-to-workspace-1

and turn Use default value OFF then insert Custom value: ['<Super>Home', '<Super>1']

enter image description here


Or if you prefer CLI you can use dconf or gsettings e.g.

gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Super>Home', '<Super>1']"

Keep in mind the values must be quoted and separated by comma+space.

0
2

Adding Super+1 and friends for workspace switching with dconf:

dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-1 "['<Super>Home', '<Super>1']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-2 "['<Super>2']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-3 "['<Super>3']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-4 "['<Super>4']"

It will not create workspaces in Gnome 3 which create them dynamically when there are windows on a previous one.

1
  • Since I return to this post once again, I'll leave a code snippet here for interested readers: assigning workspaces up to 8: for i in $(seq 1 8); do dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-$i "['<Super>$i']"; done. And a similar snippet for moving to nth workspace: for i in $(seq 1 8); do dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-$i "['<Super><Shift>$i']"; done
    – Hi-Angel
    Dec 17, 2021 at 17:38
0

Sharing my script here:

# script from https://unix.stackexchange.com/questions/361551/how-can-i-assign-redundant-shortcuts-for-switching-workspaces-in-gnome-3
# disable unnecessary dock app launch shortcuts
# https://ask.fedoraproject.org/t/super-1-keyboard-shortcuts-not-working/15187
for i in {1..9}; do gsettings set org.gnome.shell.keybindings switch-to-application-$i "[]"; done

for i in $(seq 1 9); do dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-$i "['<Super>$i', '<Control><Alt>$i']"; done
# And a similar snippet for moving to nth workspace:
for i in $(seq 1 9); do dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-$i "['<Super><Shift>$i','<Control><Shift>$i']"; done

# in the end clean it up.
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-1 "['<Super>Home','<Super>1', '<Control><Alt>1']" 
# caused by gesttings  set org.gnome.shell.keybindings switch-to-application-1
# replace '<Super>1'  with '<Super>0' since it always pops up nautilus.
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-1 "['<Super><Shift>Home', '<Super><Shift>1','<Control><Shift>1']"

dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-last "['<Super>End', '<Control><Alt>End']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-last "['<Super><Shift>End','<Control><Shift>End']"
1
  • 1
    Please explain what this script does, how it answers the question and how to use it. … … … … … Please do not respond in comments; edit your answer to make it clearer and more complete. Jul 11, 2022 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.