X410 supports Windowed Apps mode and it can be used to seamlessly intermix apps from Windows and Windows Subsystem for Linux (WSL). The following demonstrates a way to simplify managing Linux GUI apps and various UI settings with a minimal set of Xfce4 components.
We'll be using Ubuntu 18.04 from Microsoft Store but you should also be able to achieve
a similar result with any WSL distribution by following the steps described below.
After installing Ubuntu 18.04, execute the following command line first to have the installed Ubuntu binaries and data files up to date.
sudo apt update && sudo apt -y upgrade
STEP 1 Install Xfce4
There are numerous Linux GUI desktop environments, however, we're using Xfce4 for this article as it works well with WSL and its components can be individually launched.
Execute the following command to install Xfce4 desktop environment and its default terminal emulator.
sudo apt install xfce4 xfce4-terminal
When you install Xfce4 package, it also installs Xfce4 related components that are ineffective or causing unexpected behavior for WSL. You should simply remove the following packages:
sudo apt purge xfce4-power-manager xscreensaver gnome-screensaver light-locker
STEP 2 Launch X410 in Windowed Apps mode
X410 can also be launched in Windowed Apps mode using a command-line switch from a Windows Command Prompt.
STEP 3 Set DISPLAY environment variable
In order for Linux GUI apps and modules to render their output on X410, they need to know where X410 can be found. The DISPLAY environment variable is used for that purpose and it should be set to '127.0.0.1:0.0' if you're using default settings in X410. You can also get this information from the tooltip popup for X410 tray icon.
STEP 4 Start only core Xfce4 components
Xfce4 is comprised of many modules and when you launch "xfce4-session" or "startxfce4", it automatically loads them as needed. However, for our purpose, we only need two core components:
Settings Daemon (xfsettingsd)
When you first launch this daemon, it loads all the settings you previously configured for Xfce4 (ex. UI themes, mouse pointer size, keyboard layout and etc.). It'll be running in background and when you make changes to the Xfce4 settings, they'll be automatically applied to the all running X-Window apps.
We'll be customizing this panel and use it for launching Linux GUI apps.
Execute the following command line to start the core Xfce4 components listed above.
xfsettingsd --sm-client-disable; xfce4-panel --sm-client-disable --disable-wm-check &
STEP 5 Adjust the layout and app shortcuts for Xfce4 panels
When you first launch xfce4-panel, it'll ask you if you want to create default panels. When you answer "Yes", two panels are created; one for listing currently running apps and the other for launching installed apps.
We deleted the first panel and moved the second one to the right side of the Windows desktop. We also made some changes to the shortcut buttons for the panel.
Please note that since we are not using xfce4-session, the "Log Out" menu won't work; you cannot close Xfce4 using a menu from the Xfce4 panel. When you want to terminate Xfce4, you can just shutdown X410 by using its "Exit" menu.
STEP 6 Create a batch file for launching X410 and Xfce4 components
The following is a Windows batch file that launches X410 and Xfce4 components mentioned in the previous steps.
start /B x410.exe /wm
ubuntu1804.exe run "if [ -z $(pidof xfce4-panel) ]; then export DISPLAY=127.0.0.1:0.0; cd ~; xfsettingsd --sm-client-disable; xfce4-panel --sm-client-disable --disable-wm-check; taskkill.exe /IM x410.exe; fi;"
STEP 7 Create a Windows shortcut
You can directly launch the batch file created in Step 5 and have your Linux GUI environment ready. However, you can use the following VBScript and a Windows shortcut to silently launch the batch file and hide it from the Windows Taskbar. Please note that the VBScript file should be in the same folder as the batch file.
If WScript.Arguments.Count <= 0 Then
bat = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\")) & WScript.Arguments(0) & ".bat"
arg = ""
If WScript.Arguments.Count > 1 Then
arg = WScript.Arguments(1)
CreateObject("WScript.Shell").Run """" & bat & """ """ & arg & """", 0, False
You can then create a shortcut for the batch file created in Step 5 and set its "Target" as the following (The "Start in" option for the shortcut should also be pointing to the folder where the actual files are located):
wscript.exe bat-launcher.vbs xfce4-sidekick
Do you want to automatically launch the script when you log in? Just copy the shortcut to the Windows "Startup" folder!
Your Linux sidekick is now ready for some action!