summaryrefslogtreecommitdiffstats
path: root/wpos.sh
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2015-08-23 12:54:20 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2015-08-23 13:00:42 +0200
commitefa745f0b1bbf26dcd90d07146b0fa8e0c44f491 (patch)
treecc6817455c45d6c9a738682b5449f95894f87c47 /wpos.sh
parentwpos: Make some pieces of code more generic (diff)
downloaddisplay_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.
Diffstat (limited to 'wpos.sh')
-rwxr-xr-xwpos.sh15
1 files changed, 15 insertions, 0 deletions
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