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…