Ubuntu Fan

life with ubuntu on a thinkpad T40

Detecting Dual Displays

Posted by ubuntufan on October 6, 2006

So I installed Ubuntu 5.10 breezy badger because that was the media that I had. It picked up all of the hadware on my Thinkpad T40 by default. I was totally stoked. I tweaked things for a few days before thinking about trying to get dual displays working. I have read that others have done it with a pc but not a laptop. After some googleing, I found some references to folks that had it working on various Thinkpads, so I sat down to try and figure it out.

I will post my xorg.conf file some other time as I want to devote some time to explaining the different sections of the file and what they do. Today I want to go over how to detect if an external display is present and use the correct xorg.conf file and profile. I’m sure that there are many ways to skin this cat but this one works for me.

# determine whether an external display is attached
#cp /etc/X11/xorg.conf /etc/X11/xorg.conf.pre-local
if /usr/sbin/ddcprobe | grep -q "analog signal"; then
echo "External Display attached."
# set external display as exclusive primary
# cat /etc/X11/xorg.conf.pre-local | sed 's#"Single"#"Single,Reverse"#g' > /etc/X11/xorg.conf
cp /etc/X11/xorg.dual.conf /etc/X11/xorg.conf
echo "Using build-in LCD."
# set build-in LCD as exclusive primary display
# cat /etc/X11/xorg.conf.pre-local | sed 's#"Single,Reverse"#"Single"#g' > /etc/X11/xorg.conf
cp /etc/X11/xorg.conf.orig /etc/X11/xorg.conf

Copy and past the above code into a file and name it xorg.conf_switcher.sh (or whatever you want). Place it in your /etc/init.d directory. Don’t for get to issue a sudo chmod +x /etc/init.d/xorg.conf_switcher.sh command.

Ok, so what does it do? Well, ddcprobe is a neat little utility that will return cool information about your video chip, monitor(s) etc. What we’re doing here is looking for the term “analog signal” . If it’s there the xorg.dual.conf file gets copied over xorg.conf otherwise xorg.conf.orig gets copied over. I know there’s a way to specify which xorg.conf file to use at launch but this works for me. Hope this helps.

Feel free to let me know what you think and if there are ways to improve on this. I’m really liking my new Ubuntized T40. Oh, I did do a distro upgrade to 6.0.6 and it was flawless.



2 Responses to “Detecting Dual Displays”

  1. […] LCD as well as use the real estate of the laptops LCD while I’m at my desk. I wrote a previous post on detecting dual displays and switching the xorg.conf but never got around to posting my actual […]

  2. SanMartin said

    А оно Вам надо?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: