2 # Filename: grml-resolution
3 # Purpose: change X resolution via a simple menu frontend
4 # Authors: Florian Keller <florian.keller@zuerich.ch>, (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
14 rm -f "$RESOLUTION" "$ERROR"
26 CURRENT_RESOLUTION=$(xrandr | awk '/\*/ {print $1"_"$2}')
29 for i in $(xrandr | awk '{print $1"_"$2}' | grep "^[0-9]") ; do
30 STRING="$STRING $COUNTER $i"
35 # shellcheck disable=SC2086
36 dialog --title "$PN" --menu "Change X resolution via xrandr (current resolution: $CURRENT_RESOLUTION):" 0 0 0 $STRING 2>"$RESOLUTION"
39 (1) echo "Cancel pressed." ; exit 1 ;;
40 (255) echo "ESC pressed." ; exit 1 ;;
43 CHOSE=$(cat "$RESOLUTION")
45 if [ -n "$CHOSE" ] ; then
46 # shellcheck disable=SC2015
47 xrandr -s "$CHOSE" 2>"$ERROR" && \
48 dialog --title "$PN" --msgbox "Running xrandr with resolution was succesful." 0 0 || \
49 dialog --title "$PN" --msgbox "Error when running xrandr with resolution $CHOSE: $(cat "$ERROR")" 0 0