Wednesday, June 07, 2006

Dual monitors in Ubuntu

On my laptop I go from using dual monitors during the day, to just the laptop display at night. In Windows this usually happens pretty seamlessly. However Ubuntu does not seem to have a very evolved interface for setting up and using dual screens. I had to do a little digging to find the necessary information to get everything how I wanted it.

The requirements were;
  • Dual Screens (duh)
  • An "extended" desktop, not "cloned"
  • Automatic detection of monitors, and automatically set up X windows for single or multi
I got most of these things working within short order, but getting automatic detection / configuration took a little more looking. I am going to try to include all the information required here, but will also link off to the pages that I found the bits of info.

The "xorg.conf" file, located in "/etc/X11/" is the main config file for the display system of Xorg. This file contains the information for monitors, video cards, X screens, and the instructions on how to make them all work together. The first thing most people should do is plug in their second monitor and run "sudo xorgconfig". This should make X scan for hardware and update the Xorg file accordingly. This way all the info needed for your two monitors and video devices will be in there. It will probably be cloned, and it defiantly will not auto detected/adjust at boot.

unfortunately that step did not detect my additional monitor on my IBM Thinkpad, however it did work for my co-worker's laptop. Try it out and see what you get. I had to manually enter the information for my monitor.

I am not going to go into full detail on how to get all of this working, instead I am going to link to the pages that I used to get what was needed, and supply my own config files for use/examination. This way I don't have to re-hash what they already go through.

This page here has a very good xorg.conf file, and a guide to the file. Here you will learn how xorg.conf works, and what means what. This xorg.conf file is almost identical to mine.

This page here
has lots of information, a little ways down is information about dual monitors, and below that is a guide on getting what is needed for auto detection of the monitors. This page also contains the script and packages needed to get it all working.

The auto-detection relies on a couple small packages, and a simple script. It also requires that you make two extra xorg.conf files. One for single screen setup, one for multiple screens. Mine are named "xorg.conf.single" and "xorg.conf.multi". You then register the script as a startup script that. It runs before X windows, and checks through the "read-edid" package to see if there is a second monitor hooked up or not. It then moves over the appropriate xorg.conf file to replace the last used one.

The script will need to be edited to indicate your two xorg.conf files, and their location. All of this information is available through that last page.

While this may seem complicated it really isn't to bad. I do however, hope that the Ubuntu developers incorporate something like this in their next release!


No comments: