From efa745f0b1bbf26dcd90d07146b0fa8e0c44f491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Sun, 23 Aug 2015 12:54:20 +0200 Subject: 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. --- wpos.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wpos.sh b/wpos.sh index 1fecd4d..ecf47b8 100755 --- a/wpos.sh +++ b/wpos.sh @@ -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 -- cgit v1.2.3