File: fvwm-crystal.videomodeswitch-

package info (click to toggle)
fvwm-crystal 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,748 kB
  • ctags: 793
  • sloc: sh: 2,815; cs: 880; python: 875; makefile: 212
file content (29 lines) | stat: -rwxr-xr-x 635 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

# xrandr wrapper for FVWM-Crystal
# Dominique Michel <dominique_libre@users.sourceforge.net> 2013
# Released under the GNU/GPL license version 2 or any later version

LC_ALL=C

CURRENT_MODE=$( xrandr | grep '[0-9]\*' | sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:' )

ALL_MODES=( $( xrandr | grep -E "^ *[0-9]" | sed -e 's:\(^ *\)\([0-9]*x[0-9]*\).*:\2:' | sort -grs ) )

index=${#ALL_MODES[@]}
i=0

while [ "$i" -lt "$index" ]
do
    if [ "${CURRENT_MODE}" == "${ALL_MODES[i]}" ]
    then
	m=$(($i+1))
	if [ "$m" -eq "$index" ]
	then
		m=0
	fi
	NEXT_MODE="${ALL_MODES[m]}"
    fi
    let "i+=1"
done
xrandr -s "${NEXT_MODE}"