dual head with xrandr

I use a laptop with the 915GM chipset. This means that I can use xrandr (yes!!!!). During login I (automatically) run the following little script that checks if I have plugged in the external monitor and if so splits the screen. If I later on unplug the monitor I simply run the script again and same goes for replugging it.

#!/bin/sh

VGA_USED=$(xrandr | grep -c “VGA connected” )
LVDS_USED=$(xrandr | grep -c “LVDS connected” )

setup_dual_head()
{
xrandr –output LVDS –auto –pos 0x0 –left-of VGA
}

setup_mono_head()
{
xrandr –output LVDS –auto
}

if [ “$VGA_USED” == “1” ]
then
setup_dual_head
else
setup_mono_head
fi

To make this work make sure you have setup X correctly. In the screen section I have the following important part (note the virtual size):

SubSection “Display”
Viewport 0 0
Modes “1280×1024”
Virtual 2560 1824
Depth 24
EndSubSection

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s