How can a confined snap run other snaps (or applications)?

I’ve also been meaning to respond to this for a while. Thanks for working on this! I’ve read the topic and the branch. Some random thoughts without repeating (too much) what @jamesh, etc have mentioned or any nitpicking (well, one nitpick: running go fmt on all your changed/added files is recommended ;):

  • moving the to shell-support is the perfect first step. We can do everything we need to support a shell, learn a bit in the process and then tease out stuff that could be in other interfaces (eg, allowing a non-shell-support-using snap to launch its own desktop files)
  • Yes, the base declaration for shell-support will need to made more restrictive
  • /var/lib/snapd/desktop/applications/{,*} r, - if we bind mounted /usr/share/applications from the host into the snap, you could also launch non-snaps. Or we allow /var/lib/snapd/hostfs/usr/share/applications and the shell knows to look there
  • depending on what we are going to support for launching (eg desktop actions, we may want to perform additional desktop file checks/sanitizing (nothing specific; just mentioning when it goes up)). Eg, making readExecCommandFromDesktopFile() bullet-proof, etc
  • I don’t think the snapd team would want to call out to glib’s GAppInfo in general. Though, perhaps since this is only userd, calling out to C wouldn’t be terrible. Definitely get buy in from @pedronis or @mvo before changing to that though

Approach looks good and is pretty much what I expected after we last spoke @alan_g. Looking forward to the PR! :slight_smile:

1 Like

Thanks! Timely encouragement as I’m just swinging back to this after dealing with a couple of issues that came up whilst experimenting. (The one most relevant here is https://github.com/snapcore/snapd/pull/7409)

An alternative that did occur to me (because io.snapcraft.Launcher.OpenURL already execs xdg-open) is writing a C utility to parse the file and launch the app. But separating it out brings complexity of its own.

1 Like

Here you go: https://github.com/snapcore/snapd/pull/7490

1 Like

Thanks! I’ve added this to my review queue and tracking it in trello.

1 Like