EGOIST
Posted on October 9, 2020
Let's start by taking a look at the result, this is Windows running WebStorm that's installed in WSL2 (Ubuntu):
The following guide works for most Linux programs and is not limited to WebStorm.
How it works
We use VcXsrv which is a Windows Display Server that allows Windows to render GUI programs which are built for the X Window System, which is common on Unix-like operating systems.
On Windows
1. Installing VcXsrv
Install it with Chocolatey:
choco install vcxsrv
2. Open XLaunch
Press the Win key to search for XLaunch, make sure the following parameters are present when configuring it:
- Multiple Windows
- Display number = 0
- Start no client
- Disable access control
3. Modifying firewall permissions
Open Control Panel -> System and Security -> Windows Firewall:
Then give Public and Private network access to VcXsrv :
In WSL
Add the following code to your .bashrc
or .zshrc
:
export DISPLAY=${DISPLAY:-$(grep -Po '(? <=nameserver ). *' /etc/resolv.conf):0}
export LIBGL_ALWAYS_INDIRECT=1
This tells your Linux system how to find the display server.
Don't forget to run source ~/.bashrc
or source ~/.zshrc
.
Now you can run your Linux GUI programs!
Troubleshooting
Fixing blurred fonts on high resolution screens
Right-click on the VcXsrv application icon and select Properties -> Change High DPI Settings:
Then at the bottom select Application
Finally go to WSL and add the following code to .bashrc
or .zshrc
:
export GDK_SCALE=2
The mouse cursor is too small
See this answer for a solution.
Posted on October 9, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.