WSL doesn’t officially support running Linux GUI apps. Hence when you first install Ubuntu/WSL from the Store, it doesn’t include any X Window related libraries or utility programs. For minimal setup, please check the followings:
1 DISPLAY environment variable
In order for Linux GUI apps to connect to X410, you need to set the DISPLAY environment variable. You can set it just before launching your Linux GUI apps or have it permanently added to your login shell script (~/.bashrc):
echo "export DISPLAY=127.0.0.1:0.0" >> ~/.bashrc
Many Linux GUI apps use the D-Bus for inter-process communication (IPC). Try running the following commands after launching X410:
export DISPLAY=127.0.0.1:0.0 dbus-launch --exit-with-x11
If you’re getting a "command not found" error, install the ‘dbus-x11’ package:
sudo apt install dbus-x11
If you’re getting the following error:
Execute this command:
sudo dbus-uuidgen --ensure
When you launch a Linux GUI desktop environment such as Xfce4, you don’t need to worry about ‘dbus-launch’. However, if you’re launching a Linux GUI app directly, you should adjust your batch file or script to start ‘dbus-launch’ before running your actual Linux GUI app (ex. Opening a genuine Linux terminal emulator (WSL) directly from Windows File Explorer).
3 Screen savers and lockers
Screen savers and lockers are one of those essentials if you’re running Linux as the main OS for your system. But WSL lives within Windows and such executables are not needed. In fact those screen savers and lockers interfere with Windows components that can actually access hardware and do the real screen and power saving.
So if you notice screen savers and/or lockers are installed, we highly recommend removing them instead of just disabling them. For example, while installing the Xfce4 package in Ubuntu, it automatically installs ‘xscreensaver’ and adds a ‘Screensaver’ settings shortcut. You can remove it by executing the following command:
sudo apt purge xscreensaver gnome-screensaver
Removing the package also automatically removes the shortcut. The following lists removing commands for some of the popular screen savers and lockers for Ubuntu:
sudo apt purge xscreensaver sudo apt purge gnome-screensaver sudo apt purge light-locker sudo apt purge i3lock
In case you forgot about the screen locker and get a black screen, don’t panic! You can ‘kill’ the locker and get back to your desktop by using the ‘ps’ and ‘kill’ command from another Linux console.
You’re now ready to run your Linux GUI apps! Just make sure X410 is running before launching them.