Dual Monitors: devilspie2 FTW!

Because it seems there’s no good support for separate X sessions with dual monitors these days, the landscape and portrait monitors on my desk represent viewports into a larger pixel array within a single X session. As a consequence, it’s entirely possible to slide windows across the gutter between the two displays (generally producing an essentially unusable result), but one cannot flip through workspaces on only one monitor.

Worse, some programs seem to have trouble remembering that they were last seen on the portrait monitor, so I must rearrange the windows at the start of every session. First world problem, yeah, but still annoying.

I’d previously used devilspie to force windows to their proper places across monitors, sessions, and workspaces, but its s-expression syntax was impenetrable and I eventually gave up using it.

A fork (or continuation or something) called devilspie2 uses lua scripts that I can both read and write. It’s an Ubuntu package and easy to set up.

A typical script in ~/.config/devilspie2 looks like this:

if (get_application_name()=="Firefox") then

Putting Adobe Reader on the portrait monitor looks about the same:

if (get_application_name()=="acroread") then

Set /usr/bin/devilspie2 as an auto-started program and it Just Works…

6 thoughts on “Dual Monitors: devilspie2 FTW!

    1. I currently maintain the Dutch translation of devilspie2

      It’s a small world, isn’t it? Wow…

      1. The developer implemented a feature I requested within about 2 days. I felt it was only fair to contribute something back. :)

  1. If you want to be able to switch workspaces on each monitor independently, look into openbox-multihead. Openbox has a built-in method of specifying where to spawn new windows, though I use devilspie2 instead (Lua makes it super easy to do fancy stuff). BurntSushi, who maintains openbox-multihead, also has a WM called wingo that looks promising, though I haven’t gotten around to trying it myself.

    1. use devilspie2 instead

      Devilspie2 works wonderfully well: now all the windows open in the right spot and at the right size!

      I’m down to two workspaces, one for the regular stuff and the other for CAD. The new landscape monitor has 2560×1440 dots, so I can run most programs at half-screen-width and it’s good enough; the CAD stuff runs full screen, with reference material on the portrait monitor. Alt-Tab is my copilot!

      I should dump my set of Devilspie2 Lua scripts here, because I’m doomed if they ever Go Away.

Comments are closed.