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.
Exec=vs-tray
Terminal=false
Type=Application
Icon=${SNAP}/meta/gui/icon.png
StartupWMClass=VS Tray
Categories=Development;

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.

I’m sorry, there appears to be a disconnect. I’m try to gather enough information to see if this is appropriate for use of classic but the requested information isn’t being given in a form that gives a clear picture of what your application does.

You stated that the files are written out to /usr/share/applications, but that the application only runs as the user. IME, these answers are at odds with each other. In an effort to get everyone on the same page so we can move forward, please assume reviewers don’t know anything about your application. Can you please detail:

  1. what user all of the different snap’s commands run as? (eg, “vs-tray.foo is a daemon and runs as root”, “vs-tray.bar is a command and runs as the session user”)
  2. for each of the above commands, can you detail the paths that the application writes to?
  3. for each of the above commands, can you describe what other commands, if any, are executed by your application (and why) that makes the application require classic?
  4. how is configuration of vs-tray performed? Ie, how does the user ‘create a shortcut in [the] system tray’?

Note that important factors are whether or not the application runs as root, if the commands the application runs are driven by the user or the snap, how the application configures itself, etc.

@thejoaov - ping. This request cannot proceed without the requested information.

@thejoaov - re-ping - this request for classic confinement cannot proceed without the requested information. Can you please respond to @jdstrand’s questions above? If this is not received within another week, I will remove this request from our pending queue - however, if at a later date you are able to respond, we can then re-add this back to our queue.

Moving this out of our review queue. As Alex mentioned, whenever you have a chance to respond, we can put it back in the queue.