wmctrl fishy top left corner offset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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


If I substract ...

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

[rocketmouse@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@archlinux ~]$ win75 
x:0-4=-4/y:80-50=30
x:0-4=-4/y:80-50=30
[rocketmouse@archlinux ~]$ win75 -
x:0-4=-4/y:80-50=30
x:0-4=-4/y:80-50=30
[rocketmouse@archlinux ~]$ win75
x:223-4=219/y:128-50=78
x:223-4=219/y:128-50=78
[rocketmouse@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



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux