xrandr w/ laptop and ext monitor

Marko Vojinovic vvmarko at gmail.com
Wed Dec 2 13:30:03 UTC 2009


On Wednesday 02 December 2009 05:42:28 Joseph L. Casale wrote:
> Is it possible to create the default whereby the builtin LVD is then turned
>  off if the external LVD or VGA is connected? This would accomplish what I
>  need equally well.

This little script does exactly that, for me:

#! /bin/bash
if
xrandr | grep "VGA1 connected";
then
xrandr --output VGA1 --auto --output LVDS1 --off ;
fi
exit

Put it somewhere to run automatically upon login (I have it in KDE's Autostart 
configuration), and you're done. However, if you connect VGA after login, you 
need to execute the script manually. If something doesn't work, look at the 
output of "xrandr" in the terminal, maybe your devices have different names.

And of course, you need to do

xrandr --output LVDS1 --auto --output VGA1 --off

before you disconnect VGA, if you don't plan to reboot the machine.

HTH, :-)
Marko




More information about the fedora-list mailing list