This is the second post in a series on achieving an orderly desktop environment in GNOME 3, using no add-ons, only old school hacks. See also the first post in the series.
In the previous post I laid out the requirements for my ideal desktop. In the following I’m going to explain how I go about achieving this within the confines of Gnome Shell. Which immediately begs the question: Why Gnome Shell? There is a ton of alternative desktop environments and window managers out there, many of which may be more amenable to what I intend to do. I will not go into the whole desktop choice debate here. Suffice to say that I still believe that Gnome Shell can be made into a decent desktop environment with the hacks detailed in these posts.
Here’s the plan: First we’ll set static workspaces with Gnome tweak tool (alternatively dconf), then we’ll make various windows adhere to a specific workspace using devilspie and then we’ll set up a way to switch between applications using wmctrl and xbindkeys. This post will focus on getting static workspaces to work.
Static workspaces simply means that you have a fixed number of workspaces. Gnome Shell defaults to dynamic workspaces which means that it will only spawn as many workspaces as you’re currently occupying (by having windows open on them) and then one more. Put a window on the last workspaces and Gnome will spawn a new one for you. As stated in the previous post, this doesn’t work for me because my ingrained sense of order tells me that videos should open on workspace 7 regardless of whether there’s anything on 4, 5 and 6. In addition to this I feel that dynamic workspaces require me to work for that extra space where it should simply be available. Why destroy workspaces? They are not library books; nobody else is standing by without workspaces just because I have got a few more than I need? In the earliest releases of Gnome Shell this required extensions but fortunately it is now only a setting. As of Gnome Shell 3.12 you can set this in three ways.
Gnome Tweak Tool
Gnome Tweak Tool is intended to lay bare the settings that Gnome Shell tries to hide from the user. It should be available on almost any distribution that carries Gnome Shell. Fire it up, choose ‘Workspaces’ in the left hand ‘menu’. Select ‘Static’ from the ‘Workspace Creation’ dropdown menu and set your preferred number of workspaces.
My personal preference is roughly 6-8 (one for browsers, one for terminals, one for a file manager, one for office applications, one for GTD applications like WikidPad, one for graphics and one for video) but this is obviously according to taste. Less than 7 will leave some unsightly black space at the bottom of the workspace overview, though.
Dconf editor
If Gnome Tweak Tool no longer works or isn’t available (or you prefer to get a little bit more under the hood) you can edit dconf directly. dconf is where Gnome Shell stores configuration and user settings. Install the ‘dconf editor’ and fire it up. Now navigate the dconf tree in the left hand side of the window to ‘org’ > ‘gnome’ > ‘shell’ > ‘overrides’ and untick ‘dynamic-workspaces’ in the right hand side of the window. There is no ‘save changes’ button; every change takes effect immediately. Then navigate to ‘org’ > ‘gnome’ > ‘desktop’ > ‘wm’ > ‘preferences’ in the tree and find the setting ‘num-workspaces’ in the right hand side of the window. Click the number and enter your preference between 1 and 36.
Gsettings
Finally there is – obviously – a command line tool that will do it for you. The following two commands will disable dynamic workspaces and set the number of workspaces to 8. On my distribution (Arch Linux) ‘gsettings’ is part of the glib2 package and seems to be a dependency for any number of gnome packages so it’s sure to be installed along with gnome.
gsettings set org.gnome.shell.overrides dynamic-workspaces false gsettings set org.gnome.desktop.wm.preferences num-workspaces 8
References: http://jeffbastian.blogspot.dk/2012/06/static-workspaces-and-keyboard.html
Featured image by yuan2003