microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.16k stars 303 forks source link

Allow adding custom GUI apps to the start menu #1292

Closed pkeir closed 2 hours ago

pkeir commented 3 hours ago

Is your feature request related to a problem:

I recently noticed that GUI apps installed via APT in my Ubuntu 24.04 distribution were in my start menu under the distro name. This is really handy. I also often build my own GUI apps; often in an ad-hoc location within my home directory. I would like to know how to add such GUI applications I've built to the start menu.

Describe the solution you'd like:

I would like to be able to add my own GUI applications to the Windows start menu. If it is already possible, I would like some guidance on how to do this.

Describe alternatives you've considered:

I tried creating normal Windows shortcuts using wsl.exe and the --exec option, with no luck.

Additional context:

No response

pkeir commented 2 hours ago

I found the solution just by looking at the existing shortcuts I mentioned above:

  1. Navigate to %USERPATH%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Ubuntu-24.04. You should see the existing WSLG shortcuts.
  2. Copy one of the existing shortcuts within the same directory. Rename it to something appropriate.
  3. Right-click on the new shortcut. Select Properties. The Target Field may contain something like "C:\Program Files\WSL\wslg.exe" -d Ubuntu-24.04 --cd "~" -- evince.
  4. Change the evince part to the full path to your executable; e.g. "C:\Program Files\WSL\wslg.exe" -d Ubuntu-24.04 --cd "~" -- /home/XXXXXXX/apps/foo/build/myexe. Change icon if you wish (I had to copy it to the Windows file system.) Click OK.

The shortcut to the exe then appears on the Start menu under the distro name (i.e. Ubuntu 24.04).