This is the fourth 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, second and third post in the series.
Following the first two set of instructions we’ve got static workspaces and windows spawn where they should. That in itself is not terribly convenient as I now have to run up and down in the GNOME workspace stack to find the window I’m looking for – even if I just launched it – or rely on the old alt-tab trot that we know and hate from Windows. To torture this metaphor, we’re going to skip the stairs and install an express elevator thus also justifying the arbitrary choice of the post’s header image.
This is where the final piece of the puzzle comes in: A better way to start applications and switch between them. These two kinds of actions tend to be treated separately. You start up an application by clicking an icon or typing a command and then you find it again later on by different means. Both actions stem from the ‘I need application X now’ impulse. So you should channel that impulse the same way. There is an established way to integrate them, though. Windows 7+, GNOME Shell, and Mac OS X (I believe?) all tie an icon to a permanent process bar and have this work as both process launch and recall. I don’t think this is a good solution for a number of reasons: a) it’s not convenient (read: keyboard-centric) and b) I dislike bars (the taking-up-screen-space kind, not the other one one). The simple solution: Associate one application with one keyboard shortcut and leave it to the computer to figure out whether this means starting the application or retrieving a running instance. Either way it will obviously have to be on it’s proper workspace, see post the second, so we want to come to (move the focus to) the workspace of the window, rather than janking it out of it’s place and having it come to us.
To this end we introduce two tools that will help us achieve this: wmctrl for manipulating windows and xbindkeys for the keyboard shortcut bit. Also bits of Bash for glue. All of these are omnipresent on linux distibutions and should be installable as packages named just as written above. One word of warning, though. This entire series is composed of hacks but the previous ones are so established and solid that it hardly counts. This is where it gets a bit hairy.