summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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