Problem:
I have several XQuartz/X11 windows in macOS/OS X that are offscreen. I want to move them on-screen so I can save my work.
Example scenario:
You can create an example of off-screen X11 windows when using macOS/OS X with an external monitor and a screen geometry where one monitor is higher and further left to another (scroll down to see a screenshot example).
In the lower-right monitor, when opening certain windows in programs like Inkscape, those windows will be created at coordinate that you cannot access with your mouse cursor.
Workaround:
Pre:
- If not already installed, then install xdotool (easiest way is to use Homebrew)
To find out window ids and geometry:
To move a window to a visible coordinate:
Example:
Consider the following window geometry:
Inkscape has spawned the "document properties" window to a coordinate that is out of desktop 1:
Use xwininfo to find out window IDs, geometry, as well as to to find a set of on-screen coordinates:
Use xdotool to move off-screen window to an on-screen coordinate on desktop 1:
If all goes well, the window should now be visible.
Now would be a good time to save your work.
Also note that there might be some unexpected behaviour for XQuartz windows moved this way (e.g. "show all windows" still shows incorrect placement, etc.)
Where to go from here?
Some ideas:
- write a script to automatically collect all windows of a certain app into visible coordinates if they're not visible
- if you're able to and have the time to volunteer, contribute to the XQuartz project a feature to collect or clamp all windows to a given desktop :) (thanks in advance!)
Notes:
This workaround was verified to work with macOS Sierra 10.12.6, XQuartz 2.7.11, xdotool 3.20160805.1. Other versions may have different results.
References: