On the wsl 2 run
sudo apt update
sudo apt install xubuntu-desktop
I received an error about blueman, the bluetooth manager? and ignored it.
Add the following two lines to the end of ~/.bashrc
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export PULSE_SERVER=tcp:$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}')
- Download the pulse audio windows binary release and unzip it: https://www.freedesktop.org/wiki/Software/PulseAudio/Ports/Windows/Support/
- Download and install VcXsrv
Some of the configuration files need to be changed to run pulse audio correctly
In the unzipped pulse-audio folder go to etc\pulse and edit default.pa, replace the line
load-module module-waveout sink_name=output source_name=input
with
load-module module-waveout sink_name=output source_name=input record=0
and replace the line
load-module module-native-protocol-tcp
with
load-module module-native-protocol-tcp auth-anonymous=1
Not sure these changes were neccessary In the unzipped pulse-audio folder go to etc\pulse and edit default.pa, replace the line
load-module module-native-protocol-unix
with
load-module module-native-protocol-unix auth-anonymous=1
In the unzipped pulse-audio folder go to etc\pulse and edit daemon.conf.
Uncomment exit-idle-time and set it to -1 like so:
exit-idle-time = -1
Just involves creating a config.launch file with the following contents
<?xml version="1.0" encoding="UTF-8"?>
<XLaunch WindowMode="Windowed" ClientMode="NoClient" LocalClient="False" Display="-1" LocalProgram="xcalc" RemoteProgram="xterm" RemotePassword="" PrivateKey="" RemoteHost="" RemoteUser="" XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" Clipboard="True" ClipboardPrimary="True" ExtraParams="-swcursor -ac" Wgl="True" DisableAC="False" XDMCPTerminate="False"/>On the host machine, I have a batch file with the following contents that I run:
start /B config.xlaunch
start "" /B "C:\bin\pulseaudio-1.1\bin\pulseaudio.exe"On the wsl 2 terminal, I just run:
xfce4-sessionThe above command only works if the .bashrc was run, setting those environment variables. You will need to open a new wsl2 terminal to get it to work.