-
Notifications
You must be signed in to change notification settings - Fork 574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{snap,wrappers}: improve desktop file to snap app matching #14503
{snap,wrappers}: improve desktop file to snap app matching #14503
Conversation
This allows associating a desktop file with a specific snap app easily. Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
Now that desktop-file-ids are supported, the simple "$PREFIX_$APP.desktop" heuristic when looking up snap app's desktop file won't cut it. Instead, Loop through desktop-file-ids desktop interface plug attribute in order to have deterministic output and return the first matching desktop file found if X-SnapAppName entry matches the app name and fallback to the simple heuristic if no matches are found. Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question
snap/info.go
Outdated
@@ -1422,9 +1423,48 @@ func (app *AppInfo) SecurityTag() string { | |||
return AppSecurityTag(app.Snap.InstanceName(), app.Name) | |||
} | |||
|
|||
func snapAppNameFromDesktopFile(desktopFile string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we use code from desktopentry for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved parsing to desktopentry, Thanks!
7c6f13f
to
f4d4863
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you
…sktopentry package desktopentry can now parse X-SnapInstanceName and X-SnapAppName Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
f4d4863
to
ee90032
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question, the desktop files are regenerated when? Is it when snapd starts? There won't be an issue with pre-existing desktop files that don't have the X-SnapAppName
or X-SnapInstanceName
Yes, desktop files are generated when snapd starts snapd/overlord/snapstate/snapmgr.go Line 1600 in f48133c
|
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
2d960f0
to
84441c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14503 +/- ##
==========================================
+ Coverage 78.77% 78.83% +0.05%
==========================================
Files 1073 1078 +5
Lines 143693 145210 +1517
==========================================
+ Hits 113191 114473 +1282
- Misses 23401 23568 +167
- Partials 7101 7169 +68
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Now that
desktop-file-ids
are supported, the simple$PREFIX_$APP.desktop
heuristic when looking up snap app's desktop file won't cut it.Instead, Loop through
desktop-file-ids
desktop interface plug attribute in order to have deterministic output and return the first matching desktop file found if (the newly added)X-SnapAppName
entry matches the app name and fallback to the simple heuristic if no matches are found.This follows the SD170 - Custom desktop file IDs for snaps spec.