dotfiles/files/.config/i3/bin/screenplace
2016-10-31 16:51:09 +01:00

24 lines
525 B
Bash
Executable file

#!/bin/bash
dftScreen="LVDS1"
screens=$(xrandr | grep " connected" | cut -f 1 -d ' ' | grep -v "LVDS")
screen=$(echo $screens | head -n 1)
case "$1" in
"reset")
xrandr --auto
;;
"left")
[ -z "$screen" ] && >&2 echo "No screen connected." && exit 1
xrandr --output "$screen" --left-of "$dftScreen" --auto
;;
"right")
[ -z "$screen" ] && >&2 echo "No screen connected." && exit 1
xrandr --output "$screen" --right-of "$dftScreen" --auto
;;
*)
>&2 echo -e "Missing argument. Usage:\n$0 [reset|left|right]"
;;
esac