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 [REQUIRED] 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 '[ -z $DISPLAY ] && export DISPLAY=127.0.0.1:0.0' >> ~/.bashrc
Instead of always setting the DISPLAY environment variable to '127.0.0.1:0.0', the above command adds a line to '~/.bashrc' that sets the value only when it's not already assigned (-z). Such safeguard can be important for some servers that automatically set the DISPLAY environment variable when you log in. For example, if you're planning on running an SSH server in WSL and forward X11 Linux GUI apps, you must not overwrite the DISPLAY environment variable set by the server (ex. localhost:10.0).
After executing the above command, open a new Ubuntu/WSL console and run the following command to see if the DISPLAY environment variable is set correctly:
Please note that X410 also supports changing its display number with a command-line argument. In such case, you need to adjust the DISPLAY environment variable accordingly. For example, if you've set the display number to '1', you need to change the last part of the DISPLAY environment variable from ":0.0" to ":1.0". If you're using multiple WSL distros, you can use this feature to concurrently run separate GUI desktops for each one.
Are you using WSL2? Unlike WSL1, WSL2 has its own isolated network similar to Hyper-V virtual machines and you need to dynamically extract an address for connecting back to X410. More detailed information is found here.
2 [OPTIONAL] dbus-launch
Many Linux GUI apps use the D-Bus for inter-process communication (IPC). In order to check if it's properly installed, try running the following commands after launching X410 (if your version of 'dbus-launch' doesn't support the "--exit-with-x11" option, you can also try "--exit-with-session" option):
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 and getting errors about 'dbus-daemon', try running the 'dbus-launch' as mentioned above before launching your Linux GUI app. If it works, you can permanently add it to your batch file or script (ex. Opening a genuine Linux terminal emulator (WSL) directly from Windows File Explorer).
3 [OPTIONAL] 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 them by executing the following command:
sudo apt purge xscreensaver gnome-screensaver
Removing those packages also automatically removes the shortcut. You can execute the following command to remove some of the popular screen savers and lockers for Ubuntu:
sudo apt purge xscreensaver gnome-screensaver light-locker 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 Ubuntu/WSL console.
You're now ready to run your Linux GUI apps! Just make sure X410 is running before launching them.