msc

xrandr automation script with dmenu
git clone git://mcdim.xyz/msc.git
Log | Files | Refs | README | LICENSE

msc.sh (967B)


      1 #!/bin/bash
      2 
      3 primary="LVDS-1"
      4 
      5 dp=$(xrandr | grep " connected" | cut -d" " -f1 | grep -v $primary | dmenu -p "Monitor")
      6 
      7 res=$(xrandr | grep $dp -A 1 | tail -1 | tr -s " " | cut -d" " -f2)
      8 
      9 rot=$(printf "normal\nleft\nright\ninverted\ncancel" | dmenu -p "Rotation")
     10 if [ "$rot" == "cancel" ]; then exit 0; fi
     11 
     12 rl=$(printf "normal\nright\nleft\nmirror\ncancel" | dmenu -p "Relation")
     13 if [ "$rl" == "cancel" ]; then exit 0; fi
     14 
     15 if [ "$rl" == "normal" ]; then
     16 	xrandr --output $dp --mode "$res" --rotate $rot
     17 elif [ "$rl" == "mirror" ]; then
     18 	#dp1=$(xrandr | grep " connected" | cut -d" " -f1 | dmenu | grep -v $dp)
     19 	#xrandr --output $dp --mode "$res" --rotate $rot --same-as $dp1
     20 	xrandr --output $dp --mode "$res" --rotate $rot --same-as $primary
     21 else
     22 	#dp1=$(xrandr | grep " connected" | cut -d" " -f1 | dmenu | grep -v $dp)
     23 	#xrandr --output $dp --mode "$res" --rotate $rot --"${rl}"-of $dp1
     24 	xrandr --output $dp --mode "$res" --rotate $rot --"${rl}"-of $primary
     25 fi