Some lessons about running a X11 Desktop Environment on WSL.
What I’m using today:
- Windows 10 Professional
- WSL 1.0 – about to switch to fast ring to get WSL-2
- Pengwin Linux Distro – From Microsoft App Store
- X410 X11 Display Server running on Windows 10
Once Pengwin and X410 were installed, I needed to install the binaries for XFCE4.
First make sure all the latest updates and upgrades are applied:
sudo apt update
sudo apt upgrade
then install xfce4
sudo apt install xfce4
start the X410
X11 Display Server from windows, and we are almost ready to go.
Just need to tell Pengwin, to export the display to this server.
$ export DISPLAY=localhost:0
Then test:
xeyes &
If all goes well, we should have the xeyes app visible on the display.
I found that setting X410 to Floating Desktop
made it easier for me to adjust settings in the beginning. Perhaps later I’ll switch to Full Desktop. A quick tip: To toggle between floating desktop and full desktop, just hit CTRL-ALT-BACKSPACE
Starting xfce4
I’m not going to setup a login manager as I’m only going to be running locally anyway, however there are docs available if you are interested.
To start xfce4, rung the following command from your console terminal. Remember to set export DISPLAY=localhost:0
first.
startxfce4
For more see the docs for xfce4.
One of my pet annoyuances of more linux based X11 window managers, is that they always seem to want you to use a terminal with black text on white display. That’s the first thing I need to change, so edit the .Xresources
file in your home folder and add the following:
xterm*font: 10x20
xterm*background: black
xterm*foreground: limegreen
xterm*saveLines: 1000
If you want to makes lots of tweaks to the .XResources files (and let’s face it, you are developer, you ARE going to tweak), there is a handy shortcut to update the settings without restart xfce4 every time. Just run this command every time you update your .XResources
xrdb -merge .Xresources
Voila! X11 apps running beautifully in a very stable Windows 10 environment.
Note: You might notice that the web browser icon doesn’t work yet. Then ask yourself why you are trying to browse from linux when you can do the exact same things from Windows 10. Anyway, I might update you on how to install the best browser for WSL and get your beloved web browser icon working soon.
Laters.. 8)