Created
May 17, 2016 12:51
-
-
Save honza/32111bd63d57dfc424a4f4fa45f779b5 to your computer and use it in GitHub Desktop.
Toggle between single and dual screens
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=$(xrandr) | |
count=$(echo "$xrandr" | grep " connected" | wc -l) | |
if [[ $count -eq 2 ]]; | |
then | |
# Dual configuration | |
secondary=$(echo "$xrandr" | grep " connected" | grep -v "primary" | cut -d ' ' -f 1) | |
xrandr --output eDP1 --primary --output $secondary --auto --left-of eDP1 | |
else | |
# Laptop configuration | |
xrandr --output eDP1 --primary | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment