the desktop file is copied by snapcraft and customized e.g. Icon field is changed though the Exec field is not present, this leads to destkop file didn't specify Exec field
when launched.
Opening the desktop file with a text editor shows all the fields are present, only Exec missing…
now actually what I want is Exec=xdg-open http://localhost:8000 which works well if I add this line to the desktop file after snap installation.
Is adding this simple line not possible with snapcraft? was reading everywhere that snapcraft is changing Exec= to the apps command name though in my case is even missing…
Are there workarounds?
In my case my app is a daemon (with a system tray icon):
Do you have anything else defined in apps besides daemon? My guess would be it’s removing Exec because it doesn’t have anything to actually launch. Add another entry in apps and use that entry in torch.desktop to launch daemons GUI.
The Exec line needs to reference an app provided by your snap. That app could easily be a single line shell script that runs exec xdg-open http://localhost:8000.
The reason for the rewriting is to ensure that any code executed by a desktop file provided by your snap is appropriately sandboxed.