Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

xdotool `windowsize` and `windowmove` don't work in GNOME when the window is full sized

I have some keyboard shortcuts that tile windows around the screen. Under the surface, they just execute various xdotool commands.

For example, here is one that moves the current window to the left half of the screen:

xdotool getactivewindow windowsize 50% 100% && xdotool getwindowfocus windowmove 0 0

This works great most of the time, but I noticed that it doesn’t work when a particular window is "full sized". Clarification: By "full sized", I mean the window state when you double click the window heading and it expands to full size, not necessarily full screen.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

For the shortcut to work I have to resize the window to some small size or double click the window title bar to reduce the size again, and then it works great again. It seems GNOME "pins" a full sized screen that makes it immune to xdotool commands.

Is there any way around this? Is there another xdotool command that will implement this?

Thanks!

>Solution :

In your script, you will need to make sure that the window is not maximized. Remove the maximized_vert and maximized_horz using wmctrl first before manipulating it further with xdotool.

wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz && \
  xdotool getactivewindow windowsize 50% 100% && \
  xdotool getwindowfocus windowmove 0 0

The above works with X.Org. I want to inform other readers that these tools only work in a very limited way on Wayland.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading