microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
9.91k stars 296 forks source link

Alt Gr not working on wslg applications #890

Open nicoborghi opened 1 year ago

nicoborghi commented 1 year ago

Windows build number:

10.0.22623.0

Your Distribution version:

20.04

Your WSL versions:

WSL version: 0.70.5.0 Kernel version: 5.15.68.1 WSLg version: 1.0.45 MSRDC version: 1.2.3575 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22623.885

Steps to reproduce:

(Tested with both Ubuntu 20.04 and Debian 11, IT ISO keyboard)

  1. Open any GUI application (e.g., xev)
  2. Press Alt Gr
  3. Alt Gr does not work (no event is recorded in xev)

I tried changing the keyboard configuration with setxkbmap as suggested elsewhere, but it did not solve the issue.

WSL logs:

pulseaudio.log weston.log stderr.log

WSL dumps:

No response

Expected behavior:

Alt Gr key combinations work / Alt Gr key stroke is recorded by xev

Actual behavior:

Nothing

hideyukn88 commented 1 year ago

@nicoborghi, thanks for reporting the issue, WSLg utilize remote desktop protocol (RDP) and this is known issue with RDP, see https://github.com/microsoft/wslg/issues/88#issuecomment-883572735, thanks!

dermoth commented 1 year ago

Humm and it's still not fixed? Why is is even so complex? I've been running X apps for years on WSL using VcXsrv, and although WSL2 requires a bit more work to make it connect with proper access control I've never had any issue with keyboard mapping or anything else.

I've installed t on WSL2 last week-end and initially thought it was forwarding the connection to the local system... I spent an hour trying to troubleshoot a non-existent VcXsrv issue when I realized it was using Windows's X server!.

Robbson commented 9 months ago

Any news on this? I get a recording of the key in xev so all seems fine but still, it doesn't work.

dermoth commented 8 months ago

I would suggest using VcXsrv.exe, available on SF.net and also bundled with X2go.

On WSL1 it's very easy as you can connect directly to localhost (DISPLAY=:0 IIRC). For WSL2 it's trickier, you need to add the WSL's IP to your workstation's xhosts, and your workstation's IP to the WSL's DISPLAY env (it used to work with the hostname, iirc %COMPUTERNAME%.local., but is no longer the case and I have to fetch the IP address now).

I can share my updated launcher script, may need some polishing (I need to look for a way to get the ip from powershell rather than running a WSL command) . It launches an X terminal on Debian from where I can work and run other GUI apps.

I also prefer the clipboard handling with VcXsrv, iirc the primary clipboard wasn't synced to/from Windows' unique clipboard like it's normally the case with most X emulators (copy on select) and X servers for Windows.

Robbson commented 8 months ago

@dermoth Thanks, but we are coming from VcXsrv. Even when not using the performant VAIL mode for WSLg, it's a lot faster, especially in fullscreen applications. Also VcXsrv leads to problems on Windows remote machines where instances are suddenly closed when you make a short break and come back to the machine later. Very unfortunate when you have tons of windows open. Also because of firewall issues you always have to start the apps using VcXsrv from the shell, the linux app links from Windows just won't work.

The thing is, we have it already successfully running on several local Windows 10 and 11 machines without this problem. But in this case we are working on remote Windows machines and using WSL there. Those Alt Gr key comobs working fine for the WSL terminal, apps using VcXsrv and everywhere else but not in WSLg apps (X11 or Wayland).

taufderl-anvil commented 6 days ago

I am having the same issue and after years of frustration this is pushing me back to native Linux. WSL without proper keyboard layout support does not work for me.