diff options
author | Robin Obůrka <r.oburka@gmail.com> | 2016-10-11 21:53:35 +0200 |
---|---|---|
committer | Robin Obůrka <r.oburka@gmail.com> | 2016-10-11 21:53:35 +0200 |
commit | 3a51227ee9974919457f49ba7b19440b8e26f09f (patch) | |
tree | f39caccbe0a80fea4877cc16bbe2211ade1c2085 | |
parent | autodetect: Try to fix restore process (diff) | |
download | display_autoset-3a51227ee9974919457f49ba7b19440b8e26f09f.tar.xz |
autodetect: Query xrandr as function
It should be useful later. E.g. to define some timeout.
-rwxr-xr-x | autodetect.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/autodetect.sh b/autodetect.sh index 6f13330..6a7b6d4 100755 --- a/autodetect.sh +++ b/autodetect.sh @@ -54,12 +54,16 @@ handle_non_exist_mode() { xrandr --dpi "$DPI" $(off_except "$1" "$2") --output $2 --mode $4 --output $1 --mode $3 --left-of $2 } +query_xrandr() { + xrandr -q +} + compute_hash() { echo "$1" | sha1sum | cut -d' ' -f1 } ## Query current settings -XRANDR="$(xrandr -q)" +XRANDR="$(query_xrandr)" HASH="$(compute_hash "$XRANDR")" ## Get notebook display status @@ -130,7 +134,7 @@ elif [ "$EXT2_STATUS" = "disconnected" -a "$NOTE_STATUS" = "connected" -a "$EXT1 fi ## Query current status -XRANDR="$(xrandr -q)" +XRANDR="$(query_xrandr)" HASH="$(compute_hash "$XRANDR")" ## Restore known profile |