Skip to content

Instantly share code, notes, and snippets.

@remlapmot
Last active April 11, 2020 15:26
Show Gist options
  • Save remlapmot/23af202e79dc31cecb66736c5c45a2a7 to your computer and use it in GitHub Desktop.
Save remlapmot/23af202e79dc31cecb66736c5c45a2a7 to your computer and use it in GitHub Desktop.
REM Launch an X11 window
start /B ubuntu-nodec.xlaunch
REM Start pulseaudio
start "" /B "C:\bin\pulseaudio-1.1\bin\pulseaudio.exe"
REM For WSL 1
REM ubuntu1804.exe run "if [ -z \"$(pidof mate-session)\" ]; then export DISPLAY=127.0.0.1:0.0; export PULSE_SERVER=tcp:127.0.0.1; mate-session; pkill '(gpg|ssh)-agent'; taskkill.exe /IM pulseaudio.exe /F; taskkill.exe /IM vcxsrv.exe; fi;"
REM For WSL 2
ubuntu1804.exe run "if [ -z \"$(pidof mate-session)\" ]; then export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0; export PULSE_SERVER=tcp:$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'); mate-session; pkill '(gpg|ssh)-agent'; taskkill.exe /IM pulseaudio.exe /F; taskkill.exe /IM vcxsrv.exe; fi;"
@remlapmot
Copy link
Author

remlapmot commented Apr 8, 2020

  • Batch file edited from here
  • pulseaudio from here
  • Line 1: create an xlaunch file for use with Vcxsrv or call say x410.exe
  • On WSL 2 I needed the extra auth-anonymous=1 setting on line 61 of default.pa as per here but I did not need to recompile the Linux pulseaudio
  • The location of ubuntu1804.exe is %localappdata%\Microsoft\WindowsApps
  • Additional info here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment