Friday, December 28, 2007

Gnome, Gnome on the Range

I'm playing with switching window managers. For maybe ten years I've been using FVWM in one or another of its incarnations. I'm thinking it might finally be time to change to a more “modern” window manager. No particular dissatisfaction with FVWM, but I'd like a different look to the screen. It's sort of in the same thing as my Comcast/Verizon switch, except that no one's offering me a TV.

Since the default Window manager for plain-old-vanilla Ubuntu is Gnome, let's try that. It's as simple as changing your session before you log in.

Of course, that gives you plain-old-vanilla Ubuntu Gnome. I like to make my desktop look like my desktop, not some office stiff. So modifications are necessary. Most are based on my belief that a Window Manager must perform tasks that I want it to do, not the way favored by some group of software designers, no matter how talented. In FVWM these modifications were performed in the $HOME/.fvwm/.fvwmrc file. In Gnome most things things can be done from menus, to wit:

  • Launch the applications I want opened on startup: Gnome does this in the Systems => Preferences => Sessions.
  • Move applications onto another part of the desktop: With FVWM, you drag across the screen. Gnome doesn't have a virtual desktop, it has several workspaces. You can move programs between workspaces by dragging them along in the Workspace switcher, which is usually down on the right-hand side of the screen.
  • Add applications to the Menu: and generally muck up the way information is presented. With FVWM you edit the menu. In Gnome the Menu edits you. OK, not really. Right-click on Applications and select Edit Menus. When you add an application, you can also select an appropriate icon by clicking on the default icon in the application editing box.
  • Change the wallpaper randomly: This isn't a property of FVWM, but I wrote a Perl script to do it. In Gnome get the Python script background.py, and launch it on startup. What it doesn't do, at the moment, is change pictures at random intervals. That shouldn't be too hard to fix. Learning Python is one of my software goals for 2008 in any case.
  • Make programs appear in assigned workspaces: That is, I want Thunderbird to come up in workspace 1, Firefox in workspace 2, Emacs in workspace 3, etc. One application per workspace, and I can switch through them with ctrl-alt-arrowkey. To switch between windows in the same workspace, you use alt-tab.

    This isn't a part of Gnome, unfortunately. However, since this is Open Source, there are ways around it. The solution of choice here is Devil's Pie, available from the Ubuntu repositories. Install it, make sure it's running when you log in (see above), and create a directory $HOME/.devilspie that contains files like this:
    $cat ~/.devilspie/firefox.ds 
    (if
    (is (application_name) "Firefox")
    (begin
    (set_workspace 2)
    )
    )
    
    which assigns Firefox to workspace 2. Note that this doesn't launch Firefox, you have to do that yourself. When you do launch Firefox, however, it will appear in workspace 2. (Note: I originally did cut-and-paste from a published tutorial. That led to the strange Unexpected token encountered: 226 error, which apparently is because the examples use Unicode quotation marks. If you get this error you might as well type in the script by hand, it's short in any case.

There are undoubtedly a lot of tutorials out there on how to use Gnome efficiently. They're probably useful. However, remember that this is software we're talking about: back up everything you want to save, then play around. If you hopelessly frak something up, go to your backup and start over. For gnome, the simplest backup is just:

$ cd
$ mv .gnome .old_gnome
$ mv .gnome2 .old_gnome2
$ cp -r .old_gnome .gnome
$ cp -r .old_gnome2 .gnome2

which preserves your original files. Now restart Gnome, and play around. If you find you're hopelessly lost, just:

$ rm -fr .gnome .gnome2
$ mv .old_gnome .gnome
$ mv .old_gnome2 .gnome2

and you're back where you started.

1 comments:

rcjhawk said...

Note added much later: If you are using compiz (Preferences => Visual Effects => “Normal” or “Extra”), then, as mentioned in the comments of this devilspie tutorial, you must replace the “set_workspace” tag with “set_viewport”. And, of course, when you decide the compiz is a horrible drag on your system and not all that special anyway, you must change it back.