Monday, October 27, 2008

dual monitor on my laptop

Using xrandr and the monitor sitting on my desk.

Edit xorg.conf and add the "virtual" line (if there is no xorg.conf and it's
using the guess-mechanism, copy the guess from /var/log/Xorg.0.log )


Section "Screen"
...
Subsection "Display"
...
Virtual 1280 1824
EndSubSection
EndSection

Then create the script "switchDual"

$ cat bin/switchDual
#!/bin/bash

if [ -e /var/lock/subsys/gerbaudo/dualOn ]
then
echo "turning off VGA screen..."
xrandr --auto --output LVDS --mode 1280x800 --output VGA --off
rm /var/lock/subsys/gerbaudo/dualOn
else
echo "turning on VGA screen..."
xrandr --auto --output VGA --mode 1280x1024 --above LVDS
touch /var/lock/subsys/gerbaudo/dualOn
fi


As root create the dir where the lockfile is stored


# mkdir /var/lock/subsys/gerbaudo
# chown gerbaudo:gerbaudo /var/lock/subsys/gerbaudo


and add an icon for it on the desktop


$ cat ~/Desktop/startDual.desktop
[Desktop Entry]
Comment=
Comment[en_US]=
Encoding=UTF-8
Exec[$e]='/home/gerbaudo/bin/switchDual'
GenericName=startDual
GenericName[en_US]=startDual
Icon=
MimeType=
Name=startDual
Name[en_US]=startDual
Path[$e]=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DCOP-ServiceType=
X-KDE-SubstituteUID=false
X-KDE-Username=


Voila

No comments: