Created
May 31, 2018 14:17
-
-
Save brokenpylons/d8522bfb7aef0e61d6b53fc99e9844dd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| in='LVDS1' | |
| ext='HDMI1' | |
| #X server arguments | |
| eval set -- $(pgrep -a X) | |
| while (( $# > 0 )) | |
| do | |
| # Set display number | |
| if [[ $1 =~ :[[:digit:]](.[[:digit:]])? ]] | |
| then | |
| export DISPLAY="$1" | |
| fi | |
| # Set xauth cookie file location | |
| if [[ $1 = '-auth' ]] | |
| then | |
| export XAUTHORITY="$2" | |
| fi | |
| shift | |
| done | |
| if xrandr | grep "$ext connected" | |
| then | |
| # xrandr --output $in --auto --primary --output $ext --auto --right-of $in | |
| xrandr --output $ext --auto --primary --output $in --off | |
| else | |
| xrandr --output $in --auto --output $ext --off | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment