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!