1

With VcXsrv running and display configuration added to '/home/MYACCOUNT/.bashrc', I can start Linux GUI apps from WSL termin. However, since the display is only configured after terminal start, I cannot start GUI apps directly in Windows by running command, for example, "wsl.exe glxgears", in Windows CMD.

I want to create a shortcut in my Windows start menu to run a Linux GUI app directly. How can it be done?

1 Answers1

-1

You need to create a bat file with the script that launches wsl followed by the command

save this as yourfile.bat

ubuntu.exe run DISPLAY=localhost:0 YOURGUIAPP

assuming you are using ubuntu, change accordingly to your wsl distro

then create in the same directory a file called yourfile.vbs

Set WshShell = CreateObject("WScript.Shell" ) 
WshShell.Run chr(34) & "C:/full/path/yourfile.bat" & Chr(34), 0 
Set WshShell = Nothing

create a shortcut of your yourfile.vbs.

right click the shortcut, properties edit Target to:

C:\Windows\System32\wscript.exe "C:\/full/path/yourfile.vbs"

Pin the shortcut.

Additional step:

open properties, shortcut tab, click "Change Icon..." and change the icon to the original icon of the Linux app. You might find it under /usr/share/pixmaps but it could also be somewhere else depending on the distro and the application

Axeltherabbit
  • 171
  • 1
  • 1
  • 7