Two screens without rebooting, with xrandr

Dual screens can improve your productivity by up to 50%. It’s one of the reasons why I like working at home – I can hook the desktop’s monitor up to my laptop for even more coding goodness. I could hook the Cintiq up if I ran X across a network connection, but three screens would just spoil me rotten. ;)

I used to switch my xorg.conf manually depending on whether I wanted a dual-screen or single-screen setup, but that required closing all my applications and restarting X. I wondered if there was a better way to do it. I came across Ubuntu Forums: Switch view modes (twinview) without leaving/reconfiguring X?, which led me to HOWTO: YES! There IS an easy way of trying out Xorg.conf without reloading X. The main post wasn’t helpful, but the segment “HOWTO: Make use of RandR 1.2 – or the ability to stick with one X configuration and dynamically add or remove screens and change display setups dynamically” was. I checked if xrandr was on my system, and it was. I removed the unnecessary lines from my xorg.conf and added the lines about SubSection “Display”… and it worked. Hooray!

For future reference, here’s the command I used to set up my dual-screen display:

xrandr --output LVDS --right-of VGA-0   

This rocks.

  • Marc Grégoire

    I discovered this too a few weeks ago. A friend of mine runs meetings by projecting a pdf viewer, while editing the LaTeX source buffer on the screen of his laptop. He uses a Mac, but to my delight, it was remarkably easy to do with Debian too.

    See also item 2.6 at http://library.gnome.org/misc/release-notes/2.24/ . In Gnome 2.24, there’s a gui program to alter the display, without invoking xrandr at the command line.

    (By the way, very sorry to learn some people weren’t happy with your letter/e-mail; so few people send letters these days, I for one am delighted by whatever I receive.)