wslg icon indicating copy to clipboard operation
wslg copied to clipboard

Windows open out of screen and no way to bring them back

Open CComparon opened this issue 4 years ago • 17 comments

Environment

Windows build number: Microsoft Windows NT 10.0.21390.0
Your Distribution version: Ubuntu 20.10
Your WSLg version: Windows Subsystem for Linux WSLg preview 1.0.24

Steps to reproduce

Many possible examples E.g with gitk:

  1. Choose any git repo on your workstation
  2. Edit .git/config
  3. Add a section like
[gui]
        wmstate = normal
        geometry = 2162x935+4572+220 475 399
  1. in this repo, run gitk
  2. The gitk GUI window will most certainly appear somewhere outside of the screen, and there is no way to bring it back since neither WIN+LEFT, WIN+RIGHT, ALT+SPACE currently work with wslg.

WSL logs:

N/A

Expected behavior

Ideally WSLg would detect that windows are open outside of visible screen area and move them inside it if needed. Or at least one of WIN+LEFT, WIN+RIGHT, ALT+SPACE should work to allow to bring such windows back on screen. VcXsrv has a "Gather windows" emergency action that brings all X windows into Windows's primary monitor.

Actual behavior

Such windows are lost forever until process killed.

CComparon avatar Jun 27 '21 18:06 CComparon

@CComparon , thanks for reporting the issue.

Currently, with WSLg, if X11 application replace its own window after map, the window location won't be restricted within desktop area, so I guess that's what's happening here. But like xterm/xclock, when they are given some position of out of desktop area like below, it gets relocated to within visible desktop area as position is specified prior to map.

xclock -geometry +36000+36000

Would you please let us know what do you see with VcXsrv? Does it also place a window out of desktop area? (but it does allow to gather windows, so there is a work around?) Or VcXsrv ignores such out-of-range position and place window at visible area?

VcXsrv has a "Gather windows" emergency action that brings all X windows into Windows's primary monitor.

Thanks!

hideyukn88 avatar Jul 06 '21 22:07 hideyukn88

Thank you @hideyukn88 for your reply. I tried running xclock -geometry +36000+36000 and vcxsrv actually moves it spontaneously to the closest visible screen portion. Still not ideal as they are ignoring Windows taskbar so I still need to use the "gather windows" action to push it a bit from being obscured by the taskbar though. image

CComparon avatar Jul 07 '21 05:07 CComparon

Still no solution for this problem ? I am running into it very frequently.

At random, some apps decide to open at new positions, outside the window...

lelabo-m avatar Aug 13 '21 14:08 lelabo-m

@lelabo-marc, would you please double check with xwininfo to check if the window is actually placed outside of the screen ? thanks!

hideyukn88 avatar Aug 17 '21 16:08 hideyukn88

Sorry, I was away.

I am using Intellij Idea 2021.2 but I have seen this bug from the start of WSLg availability with other version of Intellij. I opened the Project Structure window using File -> Project Structure.

I used xwininfo like you asked and got the following:

xwininfo: Window id: 0x400282 "Project Structure"

  Absolute upper-left X:  235
  Absolute upper-left Y:  -12
  Relative upper-left X:  38
  Relative upper-left Y:  59
  Width: 1173
  Height: 910
  Depth: 24
  Visual: 0x25
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x24 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +235+-12  -521+-12  -521-1382  +235-1382
  -geometry 1173x910+197+-71

lelabo-m avatar Aug 30 '21 13:08 lelabo-m

A script that's roughly like the "gather windows" action, as a workaround: https://github.com/microsoft/wslg/issues/529#issuecomment-954120973

tyingq avatar Oct 29 '21 19:10 tyingq

@lelabo-m, sorry for late response, so based on the information from your xwininfo output, I would like to clarify that the partial window is actually visible on Windows desktop, but because of Y coordinate being negative, window can't be grabbed/moved by title bar. Is my understand correct?

Absolute upper-left X: 235 Absolute upper-left Y: -12

The reason I would like to ask this to rule out these cases, 1) window is actually correctly positioned, but due to other error (like https://github.com/microsoft/wslg/issues/179), window is not visible, or 2) window is actually correctly position in X11 space, but it positioned wrongly at Windows's desktop side.

Thanks!

hideyukn88 avatar Oct 29 '21 21:10 hideyukn88

@lelabo-m, sorry for late response, so based on the information from your xwininfo output, I would like to clarify that the partial window is actually visible on Windows desktop, but because of Y coordinate being negative, window can't be grabbed/moved by title bar. Is my understand correct?

Absolute upper-left X: 235 Absolute upper-left Y: -12

The reason I would like to ask this to rule out these cases, 1) window is actually correctly positioned, but due to other error (like #179), window is not visible, or 2) window is actually correctly position in X11 space, but it positioned wrongly at Windows's desktop side.

Thanks!

I'm not sure if you're still waiting for a confirmation on this, but that is exactly it.

Seems to be a very frequent problem for Intellij based IDEs, half these widgets open with some portion of the UI invisible / out of monitor.

Wintereise avatar Dec 29 '21 10:12 Wintereise

@Wintereise, thanks for your input!

hideyukn88 avatar Dec 29 '21 17:12 hideyukn88

There's even easier way, a one-liner posted here https://github.com/microsoft/wslg/issues/529#issuecomment-1146700216:

xdotool selectwindow windowmove 50 50

piotrd avatar Jun 23 '22 11:06 piotrd

I just found out quite simple workaround. Clicking win + shift + left bringing on screen the whole window. At least once I have more then one screen

wiewiurdp avatar Aug 09 '22 14:08 wiewiurdp

I just found out quite simple workaround. Clicking win + shift + left bringing on screen the whole window. At least once I have more then one screen

It doesn't work if window is child of other application. UPD: win + up worked

IlyaZha avatar Sep 16 '22 08:09 IlyaZha

The situation can be way worse if you have dual-monitor. Some windows will not be clickable till switching to one monitor mode.

SingletC avatar Oct 18 '22 19:10 SingletC

@SingletC, would you please describe the problem a bit more, like what window from which application exhibits the issue? and also please run grep rdpMonitor /mnt/wslg/weston.log, this will give me the information how you arrange the monitors. And also please make sure you are on the latest version of WSL by installing from aka.ms/wslstorepage, or by wsl --update on Windows command prompt, wsl --version should show 0.70.0 or greater, thanks!

hideyukn88 avatar Oct 19 '22 03:10 hideyukn88

This really impacts JetBrains products like IntelliJ IDEA. Child windows open all over the place, sometimes off the screen entirely.

By "child windows" I am referring to windows that open that are not registered in the taskbar.

rrileyca avatar Feb 05 '25 15:02 rrileyca

similar issue with eclipse and the installing software from the marketplace: for some packages it pops up a modal window without even a frame (looks kinda strange to begin with) to display licences or something and when you click "accept all" a second modal "do you really want to..." pops under this one :(

The only solution that works (thanks for that btw!) is

xdotool selectwindow windowmove 50 50

turchinc avatar Mar 11 '25 17:03 turchinc

It would be really handy if said windows had taskbar presence as some processes just hang awaiting user input. This is frustrating as there is no way of distinguishing between awaiting system processing versus awaiting input from a window that cannot be seen.

davidgouldbjss avatar Oct 21 '25 10:10 davidgouldbjss