Debian Codegraph @

bin/fvwm-crystal.videomodeswitch+

raw
1 #!/bin/bash
2
3 # xrandr wrapper for FVWM-Crystal
4 # Dominique Michel <[email protected]> 2013
5 # Released under the GNU/GPL license version 3 or any later version
6
7 LC_ALL=C
8
9 CURRENT_MODE=$( xrandr | grep '[0-9]\*' | sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:' )
10
11 ALL_MODES=( $( xrandr | grep -E "^ *[0-9]" | sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:' | sort -grs ) )
12
13 index=${#ALL_MODES[@]}
14 i=0
15
16 while [ "$i" -lt "$index" ]
17 do
18 if [ "${CURRENT_MODE}" == "${ALL_MODES[i]}" ]
19 then
20 m=$((i-1))
21 if [ "$m" -eq "-1" ]
22 then
23 m=$((${index}-1))
24 fi
25 NEXT_MODE="${ALL_MODES[m]}"
26 fi
27 let "i+=1"
28 done
29 xrandr -s "${NEXT_MODE}"