-
-
Notifications
You must be signed in to change notification settings - Fork 6
Add support for image-data #123
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
Conversation
|
Is that what LoadableIcon is for? The badge is intended to show the app icon so that you know which app is sending the notification in addition to the image data. We could probably not show the badge instead of showing a fallback icon, but it should still show if it's a valid app icon |
From what I understand, I think LoadableIcon would be overkill here. The image data is already defined and the pixbuf should be able to load quickly from it. I tweaked the overlay logic to not add the badge when the fallback icon is used. If no image is found, the fallback icon will still be displayed for the notification. |
davidmhewitt
left a comment
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.
Other than my two minor nitpicks, I'm happy with the code.
Would need an extra approval from someone that has tested the behaviour is correct regarding the badging of the icon on the image.
|
Can we make sure to add a test for this to the demo app? That would help to make sure we don't regress here in the future as well |
Similar to #124 (comment), adding a demo for the image-data will require using Notify.Notification instead. If that gets merged in, the patch to add this test is pretty lightweight: |
|
After reading through the Notification portal spec, it sounds like the expectation for apps sending through image data is to use a See the |
|
@danrabbit Yep, that's the spec for applications to send notifications to the portal (if they're using it), not the spec for this method on the FDO notification server. If we look at the code for the notifications portal, we can see that it's taking that BytesIcon, converting it into a pixbuf and then converting it to raw data to put on the The code in this PR is doing the reverse and turning the raw data back into a pixbuf. It may be possible to turn that back into a BytesIcon, but since we need it as a pixbuf anyway, it's probably an extra step we don't need. |
|
Sorry that wasn't clear! I was thinking in terms of the demo. But reading the code for GLib.Notification it looks like it uses a file icon and passed the image on the image-path property. Is the expectation that flatpak'd apps use libportal to send image data? |
that's for the native backend. they accept only a FileIcon or ThemedIcon and uses the i don't know if the notification portal is usable for non-sandboxed apps, so we probably need to make the test application a flatpak. |
|
@danrabbit I've adapted my branch for the latest changes to image handling. It's simplified quite a bit now:
|
danirabbit
left a comment
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.
Wow what a huge difference in the PR. This looks very clean. Nice work. I can confirm it works expected with images sent from Flatpak apps. Great work!
Also, agreed that the fallback image doesn't need to be set if we have image data. Would be nice to get an app icon, but oh well
I think we can figure out doing the flatpak for the demo in another branch
This PR adds support for the image-data notification hint. Spotify uses this for notification images, and it's part of the specification, so it seems like something we should add. This may also require updates to the indicator. Draft PR for now while I tidy it up.
Loosely related to elementary/wingpanel-indicator-notifications#193
Specification: https://developer.gnome.org/notification-spec/#hints
@elementary/ux question, should the
dialog-informationicon not be displayed if we manage to source an image?