diff options
author | Robin Obůrka <r.oburka@gmail.com> | 2015-08-23 12:54:20 +0200 |
---|---|---|
committer | Robin Obůrka <r.oburka@gmail.com> | 2015-08-23 13:00:42 +0200 |
commit | efa745f0b1bbf26dcd90d07146b0fa8e0c44f491 (patch) | |
tree | cc6817455c45d6c9a738682b5449f95894f87c47 | |
parent | wpos: Make some pieces of code more generic (diff) | |
download | display_autoset-efa745f0b1bbf26dcd90d07146b0fa8e0c44f491.tar.xz |
wpos: Add second round to restore operation and check the result of operation
There is some bug that moves some windows about 2 pixels on the x-axis. This
code checks if this happened and fixes theirs position.
This code is not perfect and duplicates some code.
-rwxr-xr-x | wpos.sh | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -2,6 +2,7 @@ DEFAULT_PROFILE="auto" SAVEPATH="/tmp/wpos" +CHECKFILE="$SAVEPATH/.tmp.check" ## Check and create main profile direcotry if [ ! -d "$SAVEPATH" ]; then @@ -46,4 +47,18 @@ elif [ "$1" = "restore" ]; then wmctrl -i -r "$ID" -e "$GRAVITY","$POSX","$POSY","$WIDTH","$HEIGHT" done + query > "$CHECKFILE" + cat "$SAVEPATH/$PROFILE" | while read LINE; do + parse "$LINE" + + [ "$GRAVITY" -lt 0 ] && continue + NEWX="$(grep "$ID" "$CHECKFILE" | awk '{print $3 }')" + [ "$(($POSY - 40 ))" -ge 0 ] && POSY=$(($POSY - 40)) + + if [ $(($NEWX - $POSX)) = 2 ]; then + POSX=$(($POSX - 2)) + wmctrl -i -r "$ID" -e "$GRAVITY","$POSX","$POSY","$WIDTH","$HEIGHT" + fi + done + fi |