Monday, March 3, 2008

How xrandr can save your blowing-mind dual monitor config in Ubuntu.

Long ago I got mad at linux because the dual monitor configuration was a mess. I had not a fast and intuitive way to use external monitor or a projector. I had to edit the xorg.conf. And if you do not have so much idea (which was my case) it was a tedious task.

Last week, I found out something relatively new: RandR (Resize and Rotate extension).

With the X extension for RandR, we can configure the monitors almost automatically and with no xorg.conf editing. There are several GUI, but they are not mature yet and what I recommend to use is the console application XRandR.

If you dispose a compatible driver such as radeon or intel (I don't know about nvidia, and fglrx does not work) I am going to give you some tips to experiment with:

To see what monitor you have connected and which ports:

xrandr -q

If you want to auto-configure them (which is possible not to work properly)
xrandr --auto
On the other hand, if you want to activate the external monitor, given the first command told us there is a VGA-0.
xrandr --output VGA-0 --on # --off to deactivate

For changing its resolution:
xrandr --output VGA-0 --mode 1440x900 (for example)

If it gives an error about maximun resolution, you should add the following lines to the monitor section of the xorg.conf

Virtual 2624 1200 # max horizontal and vertical resolution.


Now, if you want to extend the main desktop to the external monitor:
xrandr --output VGA-0 --mode 1440x900 --right-of LVDS # given LVDS is your laptop display


More info here:

http://www.thinkwiki.org/wiki/Xorg_RandR_1.2

0 comments: