Re: Issues using external monitor with Laptop
Code:
#!/bin/sh
statusvga=`xrandr -q | grep 1024x768* | grep VGA-0 | cut -c1-5`
statuslvds=`xrandr -q | grep "1400x1050*\|1024x768*" | grep LVDS | cut -c1-4`
if [ "$statusvga" != "VGA-0" ] && [ "$statuslvds" == "LVDS" ] ; then
xrandr --output LVDS --mode 1400x1050 --output VGA-0 --auto --right-of LVDS
fi
if [ "$statusvga" == "VGA-0" ] && [ "$statuslvds" == "LVDS" ] ; then
xrandr --output LVDS --off
fi
if [ "$statusvga" == "VGA-0" ] && [ "$statuslvds" != "LVDS" ] ; then
xrandr --output LVDS --mode 1400x1050 --output VGA-0 --off
fi
exit
In the script I created above which toggles the displays...
If test 1 is true (external display off and laptop display on), then the script issues the command: xrandr --output LVDS --mode 1400x1050 --output VGA-0 --auto --right-of LVDS to turn the external display on and position it to the right of the laptop display. EDITED
If test 2 is true (external display on and laptop display on), then the script issues the command: xrandr --output LVDS --off to turn the laptop display off (leaving the external display on).
If test 3 is true (external display on and laptop display off), then the script issues the command: xrandr --output LVDS --mode 1400x1050 --output VGA-0 --off to turn the laptop display on and turn the external display off.
It would seem that you want to issue the command I have if test 2 is true because both dislays are on but you want to shut off the laptop display, leaving the external display on. I can't say that my script would exactly fit your situation since my display identifications and resolutions might be different from yours. You could issue the command xrandr -q to get this information.
Last edited by David Batson; 27th December 2010 at 01:33 PM.
Fedora 19 Gnome on a ThinkPad X220, i5-2540M CPU, Intel HD Graphics 3000, Intel N 6205 wireless, and Sierra Wireless 754S Mobile Hotspot (AT&T)