I have six workspaces set up on my left monitor (and, perforce, six on the right, where I need only two) with more-or-less ritualized contents: email, browser, terminals, simulation, graphics, and whatever else comes to mind.
While I’m not attached to the notion of a particular program being on a specific workspace, I really don’t want to arrange all the programs every time this thing lights up. Alas, Xubuntu’s XFCE desktop doesn’t offer much control over where windows appear, particularly for KDE programs that don’t seem to play nicely with the rest of the desktop.
Devil’s Pie (installable with package devilspie) solves some of that problem. It doesn’t handle dual monitors with separate X sessions, is utterly undocumented, requires more than a little patience to get working, and produces baffling error messages. But it does essentially everything I need doing.
Install devilspie, which is at 0.22 -1 in the Xubuntu 8.10 universe repository.
Create ~/.devilspie to hold configuration files and create the following files therein:
; Force Firefox to workspace 2 (if (is (application_name) "Firefox") (set_workspace 2) )
; Force Gimp windows to workspace 6 (begin (if (matches (application_name) "GNU Image Manipulation Program" ) (begin (set_workspace 6) ) ) )
; Force Kmail windows to workspace 1 (begin (if (matches (application_name) "^KMail$" ) (begin (set_workspace 1) (geometry "960x1200+0+0") ) ) )
The syntax is fairly obvious, the semantics rather less so. The man page is basically useless and has been that way forever, but a true heroine has already dug through the source code and documented what you need to know. Go there and read.
If you’re doing system-wide configs for all users, you can allegedly put those files in /etc/devilspie, but I haven’t tried it out yet.
The (matches string regex) conditional allows you to do regular expression matching, which is more flexible than string equality (is string string) or substring (contains string substring) matching. What you see above represents cruft from figuring out what works.
Use the (begin …) syntax to wrap multiple statements in a single file; the parser seems to choke on anything more than one.
Put (debug) in whatever new config file you create, (re-)start devilspie from a terminal, then start the program you’re trying to control. You’ll get a torrent of information about all the various & sundry windows; pluck readable bits from them and hammer out some regex matches. Tuck one of these into a (begin …) stanza along with stuff you’re trying to make work.
Attempting starting devilspie before X comes up causes great discomfort, so you can’t start it from /etc/rc.local.
Instead, add it to XFCE’s Autostarted Applications list: System Settings -> Session and Startup -> Application Autostart, then click the Add button to put /usr/bin/devilspie in the list.
Memo to Self: this will be ideal for Mom’s PC beyond 8.04, assuming KDE continues to favor foo-foos over basic functionality.