diff options
author | Robin Obůrka <r.oburka@gmail.com> | 2014-09-07 23:57:33 +0200 |
---|---|---|
committer | Robin Obůrka <r.oburka@gmail.com> | 2014-09-07 23:57:33 +0200 |
commit | 451cd0f7b63fbbdec847deb8bc2ea559e03266fd (patch) | |
tree | a4a2a074bb88a6cc21465d62a5de9da44ce3a9d3 | |
parent | Initial commit (diff) | |
download | display_autoset-451cd0f7b63fbbdec847deb8bc2ea559e03266fd.tar.xz |
Add "external" command
-rwxr-xr-x | autodetect.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/autodetect.sh b/autodetect.sh index 495f9c3..fe7256b 100755 --- a/autodetect.sh +++ b/autodetect.sh @@ -19,11 +19,19 @@ eDP1_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $eDP1_NAME | tail -n1 | awk '{ print $ HDMI_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $HDMI_NAME | tail -n1 | awk '{ print $1 }') DP1_MAX=$(echo "$XRANDR_OUT" | grep -A 1 $DP1_NAME | tail -n1 | awk '{ print $1 }') +COMMAND="$1" + function handle_non_exist_mode { xrandr --dpi 96 --output $2 --mode $4 --output $1 --mode $3 --left-of $2 } -if [[ ($HDMI_STATUS == "connected") && ($eDP1_STATUS == "connected") && ($DP1_STATUS == "disconnected") ]]; then +if [[ ($COMMAND == "external") && ($HDMI_STATUS == "connected") ]]; then + xrandr --dpi 96 --output $HDMI_NAME --mode $HDMI_MAX --output $eDP1_NAME --off + +elif [[ ($COMMAND == "external") && ($DP1_STATUS == "connected") ]]; then + xrandr --dpi 96 --output $DP1_NAME --mode $DP1_MAX --output $eDP1_NAME --off + +elif [[ ($HDMI_STATUS == "connected") && ($eDP1_STATUS == "connected") && ($DP1_STATUS == "disconnected") ]]; then handle_non_exist_mode $HDMI_NAME $eDP1_NAME $HDMI_MAX $eDP1_MAX elif [[ ($HDMI_STATUS == "disconnected") && ($eDP1_STATUS == "connected") && ($DP1_STATUS == "connected") ]]; then |