09 December 2011
OS X Style Monitor Switching on Ubuntu
I recently decided it was complete bullshit that you can’t just plug in an external monitor and switch to it easily in Ubuntu. In OSX you’ve been able to do this for years. You just plug in your external monitor and it automatically switches to the last known good configuration for that monitor.
Anyway, with a little searching I discovered that there are some tools that you can use to get
very close to this behavior on Ubuntu. I’ve been using two tools,
auto-disper for a few months now and they are fantastic.
disper will let you switch to an external monitor effortlessly from the
command line. Whether it’s ever seen that monitor or not, it will choose the sensible
default resolution and just make it so. To wit:
disper -S to switch to
disper -s to switch back to internal (the difference is the case of the
‘s’). This tool can do much more, but that’s my 99% use case.
Then you add
auto-disper --save <profile-name>; to the mix. This will let you
store a profile for the current configuration of the monitors that are present. Then when you call
auto-disper --change, it detects the present set of monitors and switches to
the profile that matches them.
Depending on your graphics driver, you may or may not be able to go a step further and
auto-disper --change when a new monitor is plugged in. My NVIDIA
drivers won’t do that, unfortunately. If they could then it would be almost equal to the OSX
functionality. As it is, it’s quite close enough, and I am happy.
I did a full writeup on how to do all of this on the Ubuntu wiki. See DynamicMultiMonitor.