summaryrefslogtreecommitdiffstats
path: root/autodetect.sh
diff options
context:
space:
mode:
Diffstat (limited to 'autodetect.sh')
-rwxr-xr-xautodetect.sh8
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