summaryrefslogtreecommitdiff
path: root/monattach
blob: 9eef6b63fb0ed0a241eb649828ae79353d81bed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/sbin/sh

XSTATS="$(xrandr)"

PRIMARY="$(echo "$XSTATS" | grep "primary" | awk '{print $1}')"
RIGHT=false

for i in $@; do
  case "$i" in
    "right")
      RIGHT="TRUE" ;;
    "left")
      RIGHT="FALSE" ;;
  esac
done

OUTPUT="$(echo "$XSTATS" | grep ' connected ' | grep -v '[0-9]*x[0-9]*+[0-9]*+[0-9]' | awk '{print $1}' | barmenu -h 24 -p 'Which output?')"
[ -z "$OUTPUT" ] && exit 2

[ "$RIGHT" = "TRUE" ] && ARGS="--right-of $PRIMARY" || ARGS="--left-of $PRIMARY"

xrandr --output "$OUTPUT" --mode 1920x1080 $ARGS