Dual monitors in Ubuntu 9.04

I got my self two monitors so that I can work more effective both when coding, but also in other situations. I own a Dell Latitude D420 with the mediabay. In this bay there are both a VGA and a DVI port and so I can manage two monitors.

I have adjusted a script so that it works against the montors that I have:

#!/bin/bash
# If an external monitor is connected, place it with xrandr

# External output may be “VGA” or “VGA-0″ or “DVI-0″ or “TMDS-1″
EXTERNAL_OUTPUT_1=”VGA”
EXTERNAL_OUTPUT_2=”TMDS-1″
INTERNAL_OUTPUT=”LVDS”

/usr/bin/xrandr | grep $EXTERNAL_OUTPUT_2 | grep ” connected ”
if [ $? -eq 0 ]; then
xrandr –output $INTERNAL_OUTPUT –off \
–output $EXTERNAL_OUTPUT_1 –auto \
–output $EXTERNAL_OUTPUT_2 –auto –right-of VGA

else
xrandr –output $INTERNAL_OUTPUT –auto \
–output $EXTERNAL_OUTPUT_1 –off \
–output $EXTERNAL_OUTPUT_2 –off
fi

If you put this code in

/etc/X11/Xsession.d/45custom_xrandr_settings

Your session will start up with dual monitors when you boot.

Which is good.

Now I am having the same requirements as Ben Maurer who wants Ubuntu/Linux to trigger dual monitors when he puts his computer in a dock, and not when the computer is running without a dock.

I have done research which says that the state in /proc/acpi/button/lid/LID/ can be used I have not explored or tested this further.

I hope it is possible, and I hope that in the near future that it would be possible to do this without creating Xsessions.d/-hacks/scripts.

Please feel freee to post any suggestions.

You can leave a response, or trackback from your own site.

Leave a Reply