Request for classic confinement: vs-tray

My application, vs-tray, is a application to create a shortcut in system tray (for linux, windows and in the future, mac), for developers to access more easily their projects on vs code and, on github desktop. To do so, i basically spawn code and github desktop and the path for the project as arg. It works well with .deb, but with snap, it only works with classic confinement.
Built with electron, (that is because i’m javascript developer, so this is the easiest way to initiate in open source desktop development), the application is open source.

Can you provide an example invocation and the result (including location and the contents of the desktop file)?

You can see Here

This is the code to open vscode (code) in the given project path.

        label: locale.openCode,
        click: () => {
          spawn('code', [path], { shell: true });

Contents of the desktop file:

[Desktop Entry]
Name=VS Tray
Comment=Open your Projects from tray menu on Visual Studio Code, and other useful options.
StartupWMClass=VS Tray

Thanks, the Exec line looks ok, but where does this desktop file end up on the system?

it goes on /usr/share/applications

Writing to /usr/share/applications requires classic confinement since this path is not present in the runtime environment of the snap. The Exec line is ‘ok’ so long as the application uses something from /snap/bin for snaps, otherwise applications would be launched outside of confinement.

AIUI from this discussion, the application allows adding a ‘system tray’ to one’s desktop shell, and part of how this is done is that an electron application runs in the user’s session, displays things from desktop files it creates in /usr/share/applications and launches those items via electron/javascript (please correct me).

Even as classic, writing to /usr/share/applications requires root access, but it seems like the snap could run entirely within the user’s session by adding files to $HOME/.local/share/applications instead (which would require use of the personal-files interface instead of classic). Before making any changes to your snap, can you confirm my understanding of your application above and comment on use of $HOME/.local/share/applications?

@thejoaov This request is waiting on more information from you - can you please respond to @jdstrand’s question above so that it can proceed?

Yes. But as i said, the application uses the shell commands to launch other applications. The behavior is, with classic, it works normal just like the debian version, but confined it launches the programs (vscode and github desktop) like a new vs-tray window, and this, is not the expected behavior. Vscode for example, in the application confined, launches like another instance of vs-tray, without the user settings and extensions.

Thanks for getting back to us, but this doesn’t answer (all of) my question. Assuming this is granted classic, writing to /usr/share/applications requires root access, but it seems like the snap could run entirely within the user’s session by adding files to $HOME/.local/share/applications instead, can you comment?

Yes, it runs in the user’s session.