Created
September 20, 2015 23:26
-
-
Save maxking/9ac098c250390bf44bdf to your computer and use it in GitHub Desktop.
This is a script to auto-enable/disable an external display. I bind it to the screen-switch button used in windows and it works like a charm.
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
#!/usr/bin/env bash | |
xrandr | grep VGA | grep -w connected >/dev/null | |
echo $? | |
if [[ "$?" -lt 1 ]] | |
then | |
notify-send "Extending desktop to VGA screen" | |
xrandr --output LVDS1 --auto --output VGA1 --auto --left-of LVDS1 --primary | |
else | |
xrandr --output LVDS1 --auto --primary | |
notify-send "No known screens found" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: This script won't work out of box. You would have to configure external display's you are going to connect and modify the script according to your use. This is just a sample script that works for me.