microsoft / wslg

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

Hook to modify shortcuts created by WSLg #66

Open cerebrate opened 3 years ago

cerebrate commented 3 years ago

Is your feature request related to a problem? Please describe.

My specific problem/use-case is related to my use of genie (https://github.com/arkane-systems/genie) to run Linux services under systemd, and in particular, using GUI applications which either must themselves run thus or depend on services therein. At the moment, this works perfectly launching them from my usual shell, but not from the Start Menu shortcuts.

That said, I think there is also a general issue here in which people may wish to modify the way in which the created shortcuts run their GUI applications to set the environment/profile/etc, per - for example - #46 , #11, etc.

Describe the solution you'd like Ideally, I would like to be able to configure a template for the shortcuts created by WSLg, so that I could transform - for instance - the automatically created target

C:\Windows\System32\wslg.exe ~ -d Debian gnome-system-monitor

to

C:\Windows\System32\wslg.exe ~ -d Debian genie -c gnome-system-monitor

or to

C:\Windows\System32\wslg.exe ~ -d Debian my-gui-profile ; gnome-system-monitor

etc., which is to say, effectively modify the Linux command line in between the .desktop file and the Windows shortcut to include the extra behavior wanted.

Describe alternatives you've considered The obvious way to solve this without any WSLg changes would be to simply modify the Exec= line in all the relevant .desktop files to include the extra part, but that involves a lot of individual file mods that will be overwritten by package updates, inelegant even if automated, and would also affect any other application that makes use of the .desktop files. Solving this in one place would be much more elegant.

spronovo commented 3 years ago

That's a great suggestion, we'll look at adding a mechanism for this. We're looking into the problem of the profile not being applied when launching an application from the start menu, we realize this is annoying especially for folks using framework based DPI scaling... but having the ability to further customize the launch string with some preamble is a great suggestion.

jamespotz commented 3 years ago

This will come handy running MS edge on Wayland e.g C:\Windows\System32\wslg.exe ~ -d Ubuntu microsoft-edge --enable-features=UseOzonePlatform --ozone-platform=wayland