diff options
author | Robin Obůrka <r.oburka@gmail.com> | 2015-03-21 13:45:40 +0100 |
---|---|---|
committer | Robin Obůrka <r.oburka@gmail.com> | 2015-03-21 13:45:40 +0100 |
commit | ad017d523c254874e2b6edb842f403350ee1b96e (patch) | |
tree | b49d8364948000c1d2a1f648cfd75c1edafd622c /autodetect.sh | |
parent | Provide first simple version of wpos - windows restorer (diff) | |
download | display_autoset-ad017d523c254874e2b6edb842f403350ee1b96e.tar.xz |
Add command, that returns hash of current profile
Diffstat (limited to 'autodetect.sh')
-rwxr-xr-x | autodetect.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/autodetect.sh b/autodetect.sh index 5b0006f..56404ed 100755 --- a/autodetect.sh +++ b/autodetect.sh @@ -63,7 +63,19 @@ EXT1_MAX="$(echo "$XRANDR" | get_resolution "$EXT1_NAME")" EXT2_MAX="$(echo "$XRANDR" | get_resolution "$EXT2_NAME")" ## Main "profiles" logic -if [ "$COMMAND" = "external" -a "$EXT1_STATUS" = "connected" ]; then +## Start with some special command +if [ "$COMMAND" = "profile" ]; then + HASH="${NOTE_NAME}${NOTE_STATUS}${NOTE_MAX}" + [ -n "$EXT1_NAME" ] && HASH="${HASH}${EXT1_NAME}${EXT1_STATUS}${EXT1_MAX}" + [ -n "$EXT2_NAME" ] && HASH="${HASH}${EXT2_NAME}${EXT2_STATUS}${EXT2_MAX}" + echo "$(echo "$HASH" | sha1sum | awk '{ print $1 }')" + +elif [ "$COMMAND" = "none" ]; then + # String "killthemall" should be something that is NOT real screen name + xrandr $(off_except "killthemall") --output "$NOTE_NAME" --mode "$NOTE_MAX" + +## And "regular" display setting commands +elif [ "$COMMAND" = "external" -a "$EXT1_STATUS" = "connected" ]; then xrandr --dpi "$DPI" $(off_except "$EXT1_NAME") --output "$EXT1_NAME" --mode "$EXT1_MAX" elif [ "$COMMAND" = "external2" -a "$EXT2_STATUS" = "connected" ]; then @@ -85,10 +97,6 @@ elif [ "$COMMAND" = "2external" -a "$EXT1_STATUS" = "connected" -a "$EXT2_STATUS elif [ "$COMMAND" = "note" -a "$NOTE_STATUS" = "connected" ]; then xrandr --dpi "$DPI" $(off_except "$NOTE_NAME") --output "$NOTE_NAME" --mode "$NOTE_MAX" -elif [ "$COMMAND" = "none" ]; then - # String "killthemall" should be something that is NOT real screen name - xrandr $(off_except "killthemall") --output "$NOTE_NAME" --mode "$NOTE_MAX" - elif [ "$EXT1_STATUS" = "connected" -a "$NOTE_STATUS" = "connected" -a "$EXT2_STATUS" = "disconnected" ]; then handle_non_exist_mode "$EXT1_NAME" "$NOTE_NAME" "$EXT1_MAX" "$NOTE_MAX" |