Last active
August 29, 2015 14:18
-
-
Save pgericson/6e6a17251e0dda33646e to your computer and use it in GitHub Desktop.
auto config multimonitor setup for i3
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 | |
echo 'Monitor-Auto-Setup script is starting...' | |
## this should be launched from e.g. ~/.i3/config file. | |
## this is a setup with one laptop LVDS1 and 2 monitors, one HDMI and one VGA. | |
displays="$(xrandr -q)" | |
if [[ $displays =~ VGA[0-9][[:space:]]connected && $displays =~ HDMI[0-9][[:space:]]connected ]]; then | |
echo '=== LAPTOP IS PROBABLY DOCKED w/ TWO DISPLAYS ===' | |
xrandr --verbose --output LVDS1 --off; | |
xrandr --verbose --output VGA1 --auto; | |
xrandr --verbose --output VGA2 --auto; | |
xrandr --verbose --output HDMI1 --auto --right-of VGA2; | |
xrandr --verbose --output HDMI1 --auto --right-of VGA1; | |
elif [[ $displays =~ VGA[0-9][[:space:]]connected ]]; then | |
echo '=== LAPTOP IS PROBABLY DOCKED w/ ONE vga DISPLAYS ===' | |
xrandr --verbose --output LVDS1 --auto --primary; | |
xrandr --verbose --output VGA1 --auto --left-of LVDS1; | |
xrandr --verbose --output VGA2 --auto --left-of LVDS1; | |
xrandr --verbose --output HDMI1 --off; | |
elif [[ $displays =~ HDMI[0-9][[:space:]]connected ]]; then | |
echo '=== LAPTOP IS PROBABLY DOCKED w/ ONE hdmi DISPLAYS ===' | |
xrandr --verbose --output LVDS1 --auto --primary; | |
xrandr --verbose --output VGA1 --off; | |
xrandr --verbose --output VGA2 --off; | |
xrandr --verbose --output HDMI1 --auto --right-of LVDS1; | |
else | |
echo '=== LAPTOP IS NOT DOCKED ===' | |
xrandr --verbose --output LVDS1 --auto --primary; | |
fi | |
echo 'Monitor-Auto-Setup script has finished' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment