[arch-general] wmctrl fishy top left corner offset

Ralf Mardorf silver.bullet at zoho.com
Sat Apr 23 12:40:47 UTC 2016


Hi,

does anybody know, what makes the x/y coordinates of a window drift,
when setting them by the wmctrl -e option? The offset differs for other
Linux users. Instead of figuring out by trial and error what values are
needed to correct the offset, it would be nice to calculate the needed
values.

Regards,
Ralf

[rocketmouse at archlinux ~]$ wmctrl -l -G | grep test
0x02800774  1 62   137  980  643  archlinux test
              ^^^^^^^^
              ^^^^^^^^
[rocketmouse at archlinux ~]$ xdotool getwindowgeometry --shell $(xdotool getactivewindow)
WINDOW=41944948
X=62
  ^^
  ^^
Y=137
  ^^^
  ^^^
WIDTH=980
HEIGHT=643
SCREEN=0
[rocketmouse at archlinux ~]$ wmctrl -i -r 0x02800774 -e 0,62,137,500,500
                                                        ^^^^^^
                                                        ^^^^^^
[rocketmouse at archlinux ~]$ xdotool getwindowgeometry --shell $(xdotool getactivewindow)
WINDOW=41944948
X=66
  ^^
  ^^
Y=187
  ^^^
  ^^^
WIDTH=500
HEIGHT=500
SCREEN=0
[rocketmouse at archlinux ~]$ wmctrl -l -G | grep test
0x02800774  1 66   187  500  500  archlinux test
              ^^^^^^^^
              ^^^^^^^^


If I substract ...

  
[rocketmouse at archlinux ~]$ cat ~/.rocketmouse/win75/config
X_FIX=4
Y_FIX=50

[rocketmouse at archlinux ~]$ cat /usr/local/bin/win75
#!/bin/bash
eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
X_FIX=$(grep X_FIX ~/.rocketmouse/win75/config | cut -d"=" -f2)
Y_FIX=$(grep Y_FIX ~/.rocketmouse/win75/config | cut -d"=" -f2)
((XX=X-X_FIX))
((YY=Y-Y_FIX))
WIDTH=$(calc "int($WIDTH*0.75)")
case $1 in
  "") HEIGHT=$(calc "int($HEIGHT*0.75)");;
esac
echo "x:$X-$X_FIX=$XX/y:$Y-$Y_FIX=$YY"
wmctrl -i -r $WINDOW -b remove,maximized_vert,maximized_horz
wmctrl -i -r $WINDOW -e "0,$XX,$YY,$WIDTH,$HEIGHT"
eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
echo "x:$X-$X_FIX=$XX/y:$Y-$Y_FIX=$YY"
exit


... it's fixed.

[rocketmouse at archlinux ~]$ win75 
x:0-4=-4/y:80-50=30
x:0-4=-4/y:80-50=30
[rocketmouse at archlinux ~]$ win75 -
x:0-4=-4/y:80-50=30
x:0-4=-4/y:80-50=30
[rocketmouse at archlinux ~]$ win75
x:223-4=219/y:128-50=78
x:223-4=219/y:128-50=78
[rocketmouse at archlinux ~]$ win75 -
x:223-4=219/y:128-50=78
x:223-4=219/y:128-50=78

-- 
https://lists.archlinux.org/pipermail/arch-general/2016-April/date.html


More information about the arch-general mailing list