Snap creating application Icons

Hey, I’m kind of new into snap packaging, so sorry if I’m asking something that is already answered (I tried to find in the docs and here but was not successful).

I’m forking Linux Mint’s webapp application, but instead of using the browser to create webapps I’m using Nativefier to package them as Electron Apps.

This app creates desktop files into $HOME/.local/share/applications so the user can access created webapps from their launcher. Is there a way for my snap application to create those files into some folder that will appear in the launcher as executables?

Currently I’m saving the electron files into $HOME/.webapp-manager, the idea is to launch a webapp directly, without opening my application.

Also another question about packaging. Nativefier is a nodejs library, and Linux Mint webapp app is a Python / GTK application. Should I add python / node as a dependency or can I use some kind of runtime to have this. I suppose that core snap package should have python but not node installed.

Thanks!

Usually, snaps can’t access top level hidden directories and files in $HOME, however…

Strictly speaking you’d be able to write to $HOME/.local/share/applications, it would require use of the personal-files interface and this interface requires approval. I’m not on the reviewer team but I’d expect pushback because it would enable trivially bypassing the snap sandbox via being able to put any arbitrary exec= there you’d like. Similarly the $HOME/.webapp-manager causes problems and would need a personal-files interface too but I’m assuming that one’s actually flexible and could be put anywhere else out of the way (such as $SNAP_USER_COMMON)

So it’s a policy decision really, there’s really 3 possible outcomes.

  1. Outright rejection of the personal-files interface for that folder.
  2. Permission to use it but requiring the users to run snap connect ... manually to give approval.
  3. Permission to use it and automatic connection. (I just personally heavily doubt you’d get this one).

You could alternatively write the .desktop files to e.g $SNAP_USER_COMMON and have the users set up their system variables to search there for valid .desktop files too. It doesn’t violate the sandbox model but is a fair bit of manual setup they’d have to do themselves, really this is a naughty suggestion and might make the reviewers sad anyway because it’s skirting the sandboxing principles non-the-less.

And if you really wanted, you could distribute outside the store and have people sideload the app. They’d have to run snap connect themselves still and automatic updates wouldn’t work but it’s always an option

There’s no Node runtime iirc so you’d end up shipping that in your snap yourself. For the GTK components however take a look at the Gnome extensions, e.g here

1 Like

Thanks for the answer! That’s what I tough, that writing directly into $HOME/.local/share/applications will be way too permissive for a snap application. My hope is that will be a interface (or folder) that I’ll be able to create and edit desktop files, but without iterating with desktop files that points to apps outside my snap container.

I’ll see what can I do. Thanks!