displaycon (1324B)
1 #!/usr/alt/bin/rc 2 3 disp=(DisplayPort-0 HDMI-A-0) 4 5 nl=' 6 ' 7 8 oldifs=$ifs 9 ifs=$nl 10 connected=`{xrandr | grep '\sconnected'} 11 ifs=$oldifs 12 13 fn display_location_orientation { 14 xrandr --output $disp(1) --auto --scale 1.0x1.0 --primary 15 xrandr --output $disp(2) --$1 $disp(1) --rotate $2 --auto 16 } 17 18 fn display_one { 19 ifs=$nl 20 # NOTE: covers disconnected too 21 all_screens=`{xrandr | grep 'connected'} 22 ifs=$oldifs 23 extra_args=`{printf '%s' $all_screens ^ $nl | grep -v '^'$1 | awk '{print "--output", $1, "--off"}'} 24 xrandr --output $1 --primary --auto --scale 1.0x1.0 $extra_args 25 } 26 27 dmenu_args=( \ 28 'DLL: Display Left of with Left Rotation' \ 29 'DLN: Display Left of with Normal Rotation' \ 30 'DBN: Display Below with Normal Rotation' \ 31 'ONE: Primary Display Only' \ 32 ) 33 34 switch ($#connected) { 35 case 1 36 ifs=' ' 37 connected_display=`{printf '%s' $connected ^ $nl} 38 display_one $connected_display(1) 39 case * 40 ifs=':' 41 func=`{printf '%s' $dmenu_args ^ $nl | dmenu -i -l $#dmenu_args -p 'Display Profile?'} 42 ifs=$oldifs 43 switch ($func(1)) { 44 case DLL 45 display_location_orientation 'left-of' 'left' 46 case DLN 47 display_location_orientation 'left-of' 'normal' 48 case DBN 49 display_location_orientation 'below' 'normal' 50 case ONE 51 display_one $disp(1) 52 } 53 } 54 55 bgs -z $home/.config/h_wallpaper.jpg