Recently I've upgraded from Windows Subsystem for Linux v1 (WSL1) to WSL2 and in the process I had to change how I launch xfce4-terminal on Windows 10.
This post is to document what I'm doing after a reboot when I want to run xfce4-terminal (or any other terminal for that matter) natively on Windows 10.
This assumes you have installed vcxsrv
and WSL2.
- Launch Windows Terminal
- Run
wsl -d Ubuntu
(or whatever the name of your distribution/installation is) - Open a separate tab and run
ipconfig
- Write down the IPv4 address for the "Ethernet adapter vEthernet (WSL)"
- Go back to your tab that launched your WSL2.
- Edit the following script and replace the IP address with what you wrote down from the output of
ipconfig
:- For extra security generate a random text for the part immediately after
echo
.
- For extra security generate a random text for the part immediately after
export DISPLAY=172.XX.XX.1:0
mv ~/.Xauthority ~/.Xauthoritybak
touch ~/.Xauthority
magiccookie=$(echo 'L6gpGqiNXD8KsPV09VzY8IHLxWwmDKx9'|tr -d '\n\r'|md5sum|gawk '{print $1}')
xauth add "$DISPLAY" . "$magiccookie"
cp ~/.Xauthority /mnt/c/Users/yano/.Xauthority
- Save the script as
set_xauthority.sh
andchmod +x set_xauthority.sh
- Run
./set_xauthority.sh
- Now switch gears and create a Windows 10 Shortcut
- Set the "Start In" to be:
C:\WINDOWS\System32\WindowsPowerShell\v1.0
- Set the "Target":
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -windowstyle hidden -Command "wsl -d Ubuntu -e bash -c \"export DISPLAY=172.XX.XX.1:0; xfce4-terminal\""
-
Change the IP address to match the IP address from the output of
ipconfig
-
Now, Launch
vcxsrv
- When prompted for "Select display settings", select Multiple Windows.
- Select "Display Number" as
-1
. - Click Next.
- Select "Start no client" and then click Next.
- On the page for "Extra Settings," make sure the following are checked:
- "Clipboard"
- "Primary Selection"
- "Native opengl"
- Leave "Disable access control" unchecked.
- Click Next.
- Enter "C:\Users\yano.Xauthority" in the parameters textbox.
- On the "Configuration complete" page, you may choose to save it or just click Next.
-
Now you should be able to launch your new shortcut you created.
Comments
comments powered by Disqus