Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
daemon: add desktop file location for app to the API #2982
Conversation
| + return nil | ||
| + } | ||
| + appName := filepath.Base(app.WrapperPath()) | ||
| + re, err := regexp.Compile(fmt.Sprintf(`(?m)^Exec=%s .*`, appName)) |
niemeyer
Mar 10, 2017
Contributor
I thought we had a strong convention for how to name desktop files after the app name?
mvo5
added some commits
Mar 13, 2017
|
Question: as far as I know we currently assume very little of the mapping between the desktop files a snap ships, and its apps: all .desktop file a snap ships are installed; apps are not even looked at for this. In particular people are free to have multiple desktop files referring to the same app (e.g. for different options). As a not-too-contrived example, $ dpkg -L nautilus | grep '\.desktop$' | wc -l
9
$ dpkg -L nautilus | egrep '/s?bin/' | wc -l
3We're throwing away this flexibility, and it's not clear to me why. |
| - Aliases []string `json:"aliases,omitempty"` | ||
| + Name string `json:"name"` | ||
| + Daemon string `json:"daemon"` | ||
| + DesktopFile string `json:"desktop-files,omitempty"` |
niemeyer
Mar 13, 2017
Contributor
That said, do we need to expose this at all, given that we use a strong convention to find the file? In other words, it sounds trivial for Gnome Software to build the string internally instead of exposing this via an API that can't possibly be used without access to the underlying filesystem of snapd.
niemeyer
Mar 13, 2017
Contributor
Sorry, last sentence (now removed) was the original sentence which I intended to drop in favor of the actual explanation presented above.
mvo5
Mar 14, 2017
Collaborator
Indeed, we could simply ask gnome-software to implement the lookup. The upside of having it in the API is that if we ever change our mind about the convention there will be less software to change (also that we do not need to implement the convention in each software that uses snapd (snapweb, the kde version of gnome-software etc)). However given that its a really small piece of convention its not a very strong argument :) Happy to remove it from the API again.
| - } | ||
| - return res | ||
| +func (app *AppInfo) DesktopFile() string { | ||
| + return filepath.Join(dirs.SnapDesktopFilesDir, fmt.Sprintf("%s_%s.desktop", app.Snap.Name(), app.Name)) |
niemeyer
Mar 13, 2017
Contributor
This seems fine and welcome, though. May be useful for other reasons.
|
@chipaca It looks like this has happend already https://github.com/snapcore/snapcraft/blob/master/docs/metadata.md#desktop-file - I remember we used to have a loose structure precisely because people used desktop files in a very loose way. With the new convention it is still possible to nautilus called in different ways, it would require to add an app to the snap for each of them though. E.g. nautilus.open-background-dialog and then snap_nautilus.open-background-dialog.desktop. |
|
@mvo5 eh, if people who care about desktop files are fine with snapcraft doing that, then I'm fine with us continuing down that road |
mvo5
added this to the
2.24 milestone
Apr 4, 2017
|
There's a test failure in spread here:
If you scroll all the way right and look at it long enough it seems that apps are different. I didn't investigate further. |
|
We also have another prune error:
|
zyga
closed this
Apr 4, 2017
zyga
reopened this
Apr 4, 2017
|
Sorry, didn't mean to close it. |
|
| apps := make([]appJSON, 0, len(localSnap.Apps)) | ||
| - for _, app := range localSnap.Apps { | ||
| + for _, appName := range appNames { | ||
| + app := localSnap.Apps[appName] |
chipaca
Apr 4, 2017
Member
it's probably easier and clearer to leave this bit as it was, and then add a sort.Slice call at the end
zyga
Apr 4, 2017
Contributor
17:41 < zyga> Chipaca: odd, I don't have sort.Slice
17:41 < zyga> Chipaca: is that a 1.7 thing?
17:41 < Chipaca> ah
17:41 < Chipaca> if it is, then ignore me
17:41 < Chipaca> zyga— quite possibly
17:41 < pedronis> living in the future (well past) ?
17:41 < zyga> Chipaca: I wish go docs had a @since thing
17:41 < Chipaca> yeah
17:41 < zyga> :/
17:41 < Chipaca> me too
niemeyer
approved these changes
Apr 5, 2017
Thanks, and LGTM assuming this is what they need on the desktop end.
mvo5
requested a review
from
robert-ancell
Apr 5, 2017
|
@robert-ancell Could you please comment if this is what you need for gnome-software ? If so, it can go in shortly. |
|
Tested this branch and it works well, thanks! |
mvo5 commentedMar 3, 2017
This implements the API for gnome-software so that it can map desktop files from a snap application.
LP: #1661590