Created
November 28, 2018 16:34
-
-
Save Migacz85/8ef1478328c0659e11fddd47a0d72e29 to your computer and use it in GitHub Desktop.
I3 script for external monitor
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 | |
EXTERNAL_OUTPUT="HDMI1" | |
INTERNAL_OUTPUT="eDP1" | |
# if we don't have a file, start at zero | |
if [ ! -f "/tmp/monitor_mode.dat" ] ; then | |
monitor_mode="all" | |
# otherwise read the value from the file | |
else | |
monitor_mode=`cat /tmp/monitor_mode.dat` | |
fi | |
if [ $monitor_mode = "all" ]; then | |
monitor_mode="EXTERNAL" | |
xrandr --output $INTERNAL_OUTPUT --off --output $EXTERNAL_OUTPUT --auto | |
elif [ $monitor_mode = "EXTERNAL" ]; then | |
monitor_mode="INTERNAL" | |
xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off | |
elif [ $monitor_mode = "INTERNAL" ]; then | |
monitor_mode="CLONES" | |
xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto --same-as $INTERNAL_OUTPUT | |
else | |
monitor_mode="all" | |
xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto --left-of $INTERNAL_OUTPUT | |
fi | |
echo "${monitor_mode}" > /tmp/monitor_mode.dat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment