Created
January 1, 2013 20:58
-
-
Save ericrswanny/4429947 to your computer and use it in GitHub Desktop.
Bash script used for switching monitor between VGA and LVDS in Arch Linux.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script for dual monitors | |
LVDS="LVDS1" | |
VGA="VGA1" | |
CHK_VGA=$(xrandr | grep $VGA | awk ' { print $2 } ') | |
CHK_VGA_G=$(xrandr | grep $VGA | grep "+") | |
function dual_it_up() | |
{ | |
xrandr --output $LVDS --auto --output $VGA --auto --left-of $LVDS | |
} | |
function vga() | |
{ | |
if [ "$CHK_VGA" == "connected" ]; then | |
xrandr --output $LVDS --off --output $VGA --auto | |
elif [ "$CHK_VGA_G" ]; then | |
xrandr --output $LVDS --off --output $VGA --auto | |
else | |
echo "VGA Not connected" | |
fi | |
} | |
function notebook() | |
{ | |
if [ "$CHK_VGA" == "connected" ]; then | |
xrandr --output $VGA --off --output $LVDS --auto | |
elif [ "$CHK_VGA_G" ]; then | |
xrandr --output $VGA --off --output $LVDS --auto | |
else | |
xrandr --output $LVDS --auto | |
fi | |
} | |
# Logic for determinging what the xrandr command string will be | |
if [ "$1" == "dual" ]; then | |
dual_it_up | |
elif [ "$1" == "vga" ]; then | |
vga | |
elif [ "$1" == "notebook" ]; then | |
notebook | |
fi | |
# nitrogen --restore | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment