summaryrefslogtreecommitdiffstats
path: root/wpos.sh
diff options
context:
space:
mode:
Diffstat (limited to 'wpos.sh')
-rwxr-xr-xwpos.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/wpos.sh b/wpos.sh
index ecf47b8..8133b73 100755
--- a/wpos.sh
+++ b/wpos.sh
@@ -41,7 +41,6 @@ elif [ "$1" = "restore" ]; then
## Check few important values
[ "$GRAVITY" -lt 0 ] && continue
- [ "$(($POSY - 40 ))" -ge 0 ] && POSY=$(($POSY - 40))
## And run command
wmctrl -i -r "$ID" -e "$GRAVITY","$POSX","$POSY","$WIDTH","$HEIGHT"
@@ -53,12 +52,14 @@ elif [ "$1" = "restore" ]; then
[ "$GRAVITY" -lt 0 ] && continue
NEWX="$(grep "$ID" "$CHECKFILE" | awk '{print $3 }')"
- [ "$(($POSY - 40 ))" -ge 0 ] && POSY=$(($POSY - 40))
+ NEWY="$(grep "$ID" "$CHECKFILE" | awk '{print $4 }')"
- if [ $(($NEWX - $POSX)) = 2 ]; then
- POSX=$(($POSX - 2))
- wmctrl -i -r "$ID" -e "$GRAVITY","$POSX","$POSY","$WIDTH","$HEIGHT"
- fi
+ DIFFY="$(($NEWY - $POSY))"
+ DIFFX="$(($NEWX - $POSX))"
+ [ "$DIFFY" -ge 0 ] && POSY=$(($POSY - $DIFFY))
+ [ "$DIFFX" -ge 0 ] && POSX=$(($POSX - $DIFFX))
+
+ wmctrl -i -r "$ID" -e "$GRAVITY","$POSX","$POSY","$WIDTH","$HEIGHT"
done
fi