nbdd0121 / wsld

WSL Daemon - Stable X11 connection and time synchronisation for WSL2
Apache License 2.0
299 stars 26 forks source link

Feature: focus root window when XServer window loses focus #9

Closed oxc closed 3 years ago

oxc commented 3 years ago

I am facing an unnerving issue with IntelliJ IDEA running in WSL:

This seems to only apply to Java-based application, probably because they are using a separate "focus proxy" child window, which is not the window the X server is displaying, but still has the native focus.

For other X11 applications I use, when I unfocus the XServer application window, the native focus gets set to the root window.

If I simulate this behaviour by manually setting the focus to the root window after I move from IntelliJ to the terminal, things work as expected.

Would it be possible to integrate this behaviour into wsld? Whenever the wsldhost detects a window belonging to the Xserver being unfocused, it sends a command to wsld to set the X focus to the root window.

nbdd0121 commented 3 years ago

That sounds like the job for your particular X server of choice, since WSLD only forwards the X connection. WSLD does not itself understands the X protocol other than how to accept and make a connection.

oxc commented 3 years ago

I'm aware of that, and I agree. But since all servers I tried share that behavior, and wsld seems to have become a collection of workarounds for the kinks of WSL, I thought it might fit anyway.

I'll try to raise an issue with vcxsrv and see where that goes.

Edit: I'm also aware that this is probably not a wsl specific issue, but would happen for every "windowed mode" X server situation.

Edit2: In case someone stumbles across this, here is the issue in vcxsrv: https://sourceforge.net/p/vcxsrv/bugs/101/