9

I have Ubuntu 18.04 LTS WSL in y Windows 10 pro. To set graphic user interface in Linux bash shell I installed XLaunch. But to use GUI in my WSL for every login in my pc I need to launch XLaunch. Is it possible some how to launch XLaunch once and it remains as long as I use bash shell in windows 10.

Thanks,

17

Let have some background first. To configure general X11 connection, we have to set the DISPLAY variable in WSL with this command export DISPLAY=:0. Also don't forget to use this export LIBGL_ALWAYS_INDIRECT=1 command which enables direct rendering. If these were done then go to the next step: configuring VcxSrv.

VcxSrv has many command line options (XWin man page). You can get the option details with vcxsrv.exe --help command. For WSL, mainly three options are required (can be changed).

-multiwindow
Run the server in multiwindow mode.

-clipboard
Enable [disable] the clipboard integration. Default is enabled.

-wgl
Enable the GLX extension to use the native Windows WGL interface for hardware-accelerated OpenGL.

The command will be: vcxsrv.exe :0 -multiwindow -clipboard -wgl.

Now the final step is to launch it before WSL launches. There may be multiple ways to do this. Here I mention two of them.

  1. Create a shortcut with that previous command. You should mention the full path in that command. e.g. E:\VcXSrv\vcxsrv.exe :0 -multiwindow -clipboard -wgl. Here is a screenshot.

vcxsrv_shortcut

Then put that shortcut in %AppData%\Microsoft\Windows\Start Menu\Programs\Startup folder to automatically start VcxSrv when PC boots up.

  1. Another way is to add the full command in registry with this command as administrator:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /V VcxSrv /D "E:\VcXSrv\vcxsrv.exe :0 -multiwindow -clipboard -wgl"

Follow any one of the above two methods, not both. VcxSrv.exe will launch when you restart your PC.

| improve this answer | |
  • Method #2 doesn't work for me while method #1 does work, but it doesn't prevent the settings screen for VcxSrv from opening on start up. I cannot find an option to prevent that from happening. Does anyone know how to do that? VcxSrv 1.20.5.1 – Finncent Price Dec 31 '19 at 19:41
1
  1. Open %AppData%\Microsoft\Windows\Start Menu\Programs\Startup in File Explorer

  2. Create there a new file named config.xlaunch with the following content:

    <?xml version="1.0" encoding="UTF-8"?>
    <XLaunch WindowMode="MultiWindow" ClientMode="NoClient" LocalClient="False" Display="0" LocalProgram="xcalc" RemoteProgram="xterm" RemotePassword="" PrivateKey="" RemoteHost="" RemoteUser="" XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" Clipboard="True" ClipboardPrimary="False" ExtraParams="" Wgl="True" DisableAC="True" XDMCPTerminate="False"/>
    
| improve this answer | |
0

A shortcut with the following command line works for me:

"C:\Program Files\VcXsrv\vcxsrv.exe" -ac -terminate -lesspointer -nodecoration -clipboard -wgl

| improve this answer | |
  • When I do that I can start XFCE4 but although the keyboard works and I see the desktop and the mouse moves, mouse clicks are ignored. Suggestions? – Mike Slinn Jul 17 at 1:41
  • @Richard can you please edit your answer to clarify how it is different from the other answer? More specifically what those extra arguments are for (-ac -terminate -lesspointer -nodecoration)? – Marco Lackovic Jul 24 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.