projects
/
grml-scripts.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
grml-resolution: Quick 'n dirty xrandr output parser fix
[grml-scripts.git]
/
usr_bin
/
grml-resolution
diff --git
a/usr_bin/grml-resolution
b/usr_bin/grml-resolution
index
5b334d7
..
08d075a
100755
(executable)
--- a/
usr_bin/grml-resolution
+++ b/
usr_bin/grml-resolution
@@
-23,11
+23,10
@@
COUNTER=0
STRING=""
# current mode
STRING=""
# current mode
-CURRENT_NUM=$(xrandr | awk '/\*/ {print $1}' | tr -d '*')
-CURRENT_RESOLUTION=$(xrandr | awk '/\*/ {print $2 $3 $4}')
+CURRENT_RESOLUTION=$(xrandr | awk '/\*/ {print $1"_"$2}')
# menu
# menu
-for i in $(xrandr | awk '{print $
2$3$4
}' | grep "^[0-9]") ; do
+for i in $(xrandr | awk '{print $
1"_"$2
}' | grep "^[0-9]") ; do
STRING="$STRING $COUNTER $i"
((COUNTER++))
done
STRING="$STRING $COUNTER $i"
((COUNTER++))
done
@@
-43,9
+42,7
@@
esac
CHOSE=$(cat "$RESOLUTION")
CHOSE=$(cat "$RESOLUTION")
-if [ "$CHOSE" = "$CURRENT_NUM" ] ; then
- dialog --title "$PN" --msgbox "Chosen resolution corresponds to current resolution. No changes needed." 0 0
-elif [ -n "$CHOSE" ] ; then
+if [ -n "$CHOSE" ] ; then
# shellcheck disable=SC2015
xrandr -s "$CHOSE" 2>"$ERROR" && \
dialog --title "$PN" --msgbox "Running xrandr with resolution was succesful." 0 0 || \
# shellcheck disable=SC2015
xrandr -s "$CHOSE" 2>"$ERROR" && \
dialog --title "$PN" --msgbox "Running xrandr with resolution was succesful." 0 0 || \