Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i've defined some shortcuts to access each of my workspaces:

<Super>+1 for the First
<Super>+2 for the Second

when I assign these shortcuts, they function properly until I reboot. I have no idea why it's happening.

For some reason, On the desktop I have at work (same distrib, 10.10), it works fine.

To make them function again, I need to un-asign all of them, and then reasigning them again.

I have a script which automate these operations:

gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_1
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_2
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_3
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_4
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_5
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_6
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_7
gconftool-2 --unset /apps/metacity/global_keybindings/switch_to_workspace_8

gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_1 "<Mod4>ampersand"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_2 "<Mod4>eacute"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_3 "<Mod4>quotedbl"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_4 "<Mod4>apostrophe"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_5 "<Mod4>parenleft"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_6 "<Mod4>minus"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_7 "<Mod4>egrave"
gconftool-2 -t str --set /apps/metacity/global_keybindings/switch_to_workspace_8 "<Mod4>undersocre"

But when I configure this script to be run at startup, strangely it doesn't work.

Anyone have clues about how to solve this ?

share|improve this question

It appears not to be working on Natty + compiz (it works if you use metacity - metacity --replace). You can workaround this way:

You can use wmctrl and make shortcuts for specifics commands.

Basics commands:

If you are using metacity:
wmctrl -d to show all of your workspaces.
wmctrl -s <workspace_name> to change to a specific workspace.

If you are using Compiz:
you will have to do a trick because Compiz "workspaces" are actually Viewports of a single Workspace.

Trick Instructions

Check the output of wmctrl -d For example, mine is:

0 * DG: 4098x2304 VP: 1366,0 WA: 0,23 1366x745 N/A

This means that actually I have one Workspace of 4098 x 2304 instead of what I "think" I have (nine "workspaces", 3 x 3).
I was at what was supposed to be "workspace" 2, but actually I was at viewport (VP) 1366,0 (4098 / 3 = 1366) as showed by the output above.

So this is how it works: we take the whole Workspace and divide for the numbers of "workspaces" we "think" we have. In my case: 4098 / 3 = 1366 and 2304 / 3 = 768.

if I want to go to my "workspace" 1, the command is:
wmctrl -o 0,0

Then, if I want to go to my "workspace" 4, the command is:
wmctrl -o 0,768

if I want to go to my "workspace" 8, the command is:
wmctrl -o 1366,1536

if I want to go to my "workspace" 9, the command is:
wmctrl -o 2732,1536

Got it? ;-)

Making the shortcuts

1) We will need Compiz Settings Manager.

You can install these from the Ubuntu Software Center or by clicking here

2) Open Compiz (Alt + F2 and type ccsm and hit Enter)

3) Go to Commands and add for example wmctrl -o 0,0 to one command

4) Then go to Keybindings and make the <Super>+1 shortcut for it.

5) Repeat steps "3" and "4" for the others workspaces.

share|improve this answer
thanks for your answer. Unfortunalety, the update to ubuntu 11 proposed by the update manager really screwed my system, so I cannont test this for now. I'll try as soon as possible, but I'm disturbed to have to use this workaround because those shortcuts actually works on my work install (same ubuntu 10.04 64bits, same compiz). – BiAiB May 16 '11 at 22:09
I know that... Hope it can be fixed ASAP. Meanwhile you can workaround ;-) – desgua May 16 '11 at 22:29

I had exactly the same issue with a few compiz settings. Here is my that I run on each boot, with an entry in "Startup Applications" (I run 12.10), that resets some settings that get kicked back to default when the computer reboots.

As a side note, we should really submit a bug on this.


#fix min and maximize    
gsettings set org.gnome.desktop.wm.keybindings maximize "['<Super>Up']"
gsettings set org.gnome.desktop.wm.keybindings unmaximize "['<Super>Down']"

#fix switch to workspace shortcuts
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Primary><Shift><Alt>KP_Home']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-2 "['<Primary><Shift><Alt>KP_Up']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-3 "['<Primary><Shift><Alt>KP_Page_Up']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-4 "['<Primary><Shift><Alt>KP_Left']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-5 "['<Primary><Shift><Alt>KP_Begin']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-6 "['<Primary><Shift><Alt>KP_Right']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-7 "['<Primary><Shift><Alt>KP_End']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-8 "['<Primary><Shift><Alt>KP_Down']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-9 "['<Primary><Shift><Alt>KP_Page_Down']"
share|improve this answer
thanks for your answer. Presently, I installed another version of Ubuntu so I do not have the issue anymore. Anyway, could you be more precise with "I run on each boot" ? do you do it manually? – BiAiB Jun 14 '13 at 9:17
Added a note that I use "Startup Applications" to run this script on each boot. Hope that makes sense. – Mark Mandel Jun 14 '13 at 23:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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