diff options
Diffstat (limited to 'scripts/xrandr.sh')
| -rwxr-xr-x | scripts/xrandr.sh | 35 | 
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/xrandr.sh b/scripts/xrandr.sh new file mode 100755 index 0000000..1827cd7 --- /dev/null +++ b/scripts/xrandr.sh @@ -0,0 +1,35 @@ +#!/bin/sh +all=$(xrandr | grep "connected" | cut -d' ' -f1 | paste -s -d' ') +available=$(xrandr | grep " connected" | cut -d' ' -f1 | paste -s -d' ') +set -- $available + +printf "connected: " +printf "%s " $available +printf "\n" + +printf "all: " +printf "%s " $all +printf "\n" + +if [ "$1" == "eDP1" ]; then +    # this is a laptop so awesome! + +    if [ "$#" != "1" ]; then +        # ensure the main one is turned on yeah +        xrandr --output eDP1 --mode 1920x1080 --pos 0x0 --rotate normal + +        # put the non main one to the left (assume its +1920 because im lazy) +        xrandr --output "$2" --primary --mode 2560x1440 --pos 1920x0 --rotate normal +    else +        # ensure the main one is turned on yeah +        xrandr --output eDP1 --primary --mode 1920x1080 --pos 0x0 --rotate normal +    fi +    #disconnect all the rest i think +    for x in $all; do +        echo disconnecting $x +        case $available in +            *"$x"*) ;; +            *) xrandr --output "$x" --off +        esac +    done +fi  | 
