Why can't I move a window to the top left corner with wmctrl in Unity?
Solution 1:
Probably not the answer you were looking for:
Issues with the combination of Unity and wmctrl
The combination of Unity and wmctrl
unfortunately has a few peculiarities, of which the behaviour you describe is one.
Looking at your output
- The
65,24
you mention, are the width of the Unity Launcher and the height of your panel. -
In the line:
0x03400005 0 0 24 65 1111 janw_VirtualBox unity-launcher
in the output of
wmctrl -lG
, you can see that the Launcher is positioned atx=0, y=24
, while the size of the launcher is65 x 1111
. (1111
is the height of your screen minus the height of your panel)
Strictly, the command to place the active window in the top left corner should therefore be:
wmctrl -r :ACTIVE: -e 0,65,24,1500,550
and not:
wmctrl -r :ACTIVE: -e 0,0,0,1500,550
However, this will not solve the issue, it simply is a bug. There still will be the marge you describe. The same will happen by the way when using xdotool
(not installed by default):
xdotool windowmove "$(xdotool getactivewindow)" 65 24
or
xdotool windowmove "$(xdotool getactivewindow)" 0 0
Reading the output of wmctrl -dG
Looking at the 1792x1111
in WA: 65,24 1792x1111
, you can see that you have a monitor resolution of 1857
(65
+1792
) x 1135
(1111
+24
).
In this case, it matches exactly the values in DG: 1857x1135
, since you only have one viewport (workspace): DG
stands for the total size of your desktop (all viewports).
Summarizing
Both wmctrl
and xdotool
work fine if you set a window maximized. The effect you describe will not occur. Moving or resizing windows will however leave a few pixels from both the launcher and the panel, as described in this answer.:
"The window to be moved/re-sized needs to be at least a few px from both the Unity launcher and the top panel."
Apart from what you describe, another issue you will run into if you start playing around with wmctrl
and Unity
is the deviation, as described in this one.