3

This is a followup to old questions WSL2 X11 programs "disappear" and

Is there a way to re-attach an X Window if my X Server is in Windows?

These are from the pre-wslg era, but now I have the same issue on

WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1848

(Ubuntu 22.04). I run emacs and GAP from inside emacs in a wslg window, then computer goes to sleep, when I wake it up the window is gone, although all the processes are intact.

Does anybody know a solution to this?

1
  • 2
    I've been having the same issue for months now with no solution found. I can say that the connection itself to the x server is not lost because if I tab into the invisible window and press F11 in VSCode to enter full screen, the window appears. Only to disappear again after exiting full screen. Oct 26, 2023 at 1:31

3 Answers 3

1

I don't have a solution but a work-around. My version of WSL2 in Windows 11:

PS> wsl --version
WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2861

I'm running emacs from Ubuntu 22.04 LTS WSL. When the emacs window(s) disappear I start second emacs instance (emacs&) and the lost window(s) of the first emacs instance re-appear. Then I just quit the second emacs instance and continue working with the first emacs instance.

1

What helped me is this script by the github user tyingq, I found it among the wslg issues:

#!/usr/bin/bash
sx=30
sy=30
for window in $(xdotool search -name .)
do
   xdotool windowmove $window $sx $sy
   xdotool windowunmap $window
   xdotool windowmap $window
   sx=$(($sx + 40))
   sy=$(($sy + 40))
done
0
1

For me, simply starting another X application, any application, will do the trick. I use xeyes for that. Then all windows reappear.

I have also (server-start) in my .emacs, and I check the status of the apparently disappeared, invisible emacs from a wsl text console, with emacsclient -nw . (the dot belongs to the command).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .