From 15b96ce24cdeb7c0c26756fa717b4e8294367294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Wed, 2 Mar 2016 16:39:18 +0100 Subject: Fix it to new weired behavior of new driver Now, it is sensitive to any shift of coordinates. It is much more portable --- wpos.sh | 13 +++++++------ 1 file 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 -- cgit v1.2.3