Managing Windows Start menu & icons for WSL direct install software
Solution 1:
Short answer
For each app for which you want Windows to create a Start Menu entry, create an <appname>.desktop
file.
Explanation
This looks (and seems to be, when I tried it) pretty straightforward. According to the Github readme for WSLg:
This channel is used by Weston to enumerate all Linux GUI applications (i.e. applications which have a desktop file entry of type gui) along with their launch command line and icon. The open source WSLDVCPlugin processes the list of Linux GUI applications sent over this channel and creates links for them in the Windows start menu.
So the Linux side of things is responsible for looking for <appname>.desktop
files, like it usually does to create menu entries in the Linux desktop manager. Microsoft has tapped this mechanism in their implementation to send notification of installed apps through RDP to Windows, where the plugin creates the Start Menu entry.
So to create a Windows Start Menu item, just create a corresponding `/usr/share/applications/.desktop':
sudo bash -c 'cat << EOF > /usr/share/applications/<appname>.desktop
[Desktop Entry]
Type=Application
Name=<appname>
Exec=/path/to/app
EOF'
Additional notes
-
The Start Menu item shows up within a second or so on my installation (Win 11 in a nested-virtualization Skylake VM).
-
Note that it seems that the
.desktop
file does need to be in/usr/share/applications
. In my testing~/.local/share/applications
did not work. -
Also, in my testing, desktop files with
Terminal=true
seem to be ignored. -
Deleting
<appname>.desktop
files does remove the Start Menu entry as well.