-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Implement v2 notification spec #1298
base: main
Are you sure you want to change the base?
Conversation
What is the case for letting an app play a sound freely? In the discussion there was talk of linking sound playback to specific cases, e.g. alarm, new message, new email. Also, it seems to me that the question of custom sounds versus system sounds still needs to be resolved for these example cases, unless there is a valid case to allow an app to play sound freely. |
It's not that apps are allowed to play sound freely, they are allowed to set it. The server may decided whether to play the sound. In GNOME Shell we have a policy system that controls whether a notification can have a sound or not.
I think this doesn't need to be exclusive and I don't see how it would conflict with class specific sounds.
Apps already can play any sound if they have the correct sandbox permission. So we prefer that apps use the notification sound so that the system policy can be respected e.g. do-not-disturb. Although, we may want to restrict the type and length of the sound a notification can have. |
What is driving me nuts in the freedesktop notification spec is that there's no way to know that system sounds are supported and which music formats are supported for custom sounds. This made the sound spec part just unusable when I attempted to play sound with it:
This resulted in application always playing the notification sound on its own. I really hope these problems will be solved in the new API. |
eae298c
to
6cb0d0b
Compare
1c893d7
to
9c11013
Compare
9c11013
to
60db472
Compare
I think one thing to check is if there are static permissions that can help apps guess what mode the device is in (sound, vibration, silent, DND). For example, alarms will certainly be allowed by users, because they are logically important to them. In fact, apps that will use alarm notifications will be able to play sound (because in any mode you cannot completely mute the sound, unless it can be done selectively without dynamic permission), but especially to present a notification (even more so if this is also not constrained by specific experience and actions). |
5705ffc
to
049806c
Compare
@pwithnall thanks for the review :) |
049806c
to
fc2483f
Compare
Still have to look at the sound validator but I'm through with everything else. |
if (xdp_validate_icon (sealed_icon, NULL, NULL)) | ||
g_variant_builder_add (builder, "{sv}", "icon", icon); |
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.
This is now passing through the fd to a backend which might not support this and the icon will get ignored. We could serialize the XdpSealedFd and pass GBytes to the backend if it doesn't support this or are we okay with not supporting older backends?
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.
yes, it's version 2 of the specs and the backend also needs to support them. not sure if we should add version property for the backend and for all new properties? @GeorgesStavracas what do you think?
src/validate-icon.c
Outdated
|
||
format = gdk_pixbuf_get_file_info (filename, &width, &height); | ||
if (format == NULL) | ||
if (!(mapped = g_mapped_file_new_from_fd (input_fd, FALSE, &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.
Wondering if this also should use XdpSealedFd
, but I guess there isn't really any benefit and would make it harder to call the program from a shell.
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.
i don't think that's important. If we want to improve the validator even more i would to it later and switch to https://gitlab.gnome.org/sophie-h/glycin
b59b7fd
to
ea18382
Compare
ea18382
to
3362e9c
Compare
Icons could potentially be really big in size. Instead of passing the data via GBytesIcon (as part of the D-Bus message) allow passing a sealed fd created with `memfd_create()`
This property allows applications to specify a sound to be played whenever the notification is displayed. The format used is inspired by the serialized from of GIcons.
The `markup-body` property allows applications to set markup on the body. The used markup is a subset of html limted to <b>, <i> and <a>.
The `desktop-file-id` allows applications to specify the desktop file that should be used to look up information about the app. This is especially useful for unsandboxed apps where the portal can't look up the desktop file id based on the app id.
This property allows apps to specify how the notification is displayed.
We need to hand out the activation token for XDG Activation in some way. I think it's pretty nice that we can just add the same platform data as used for DBus Activation to the ActionInvoked signal.
The category allows the notification server to handle specific notification different. E.g. calls notifications.
The purpose for a button allows the notification server to style the button specially and know the purpose of the button.
Let applications query supported options for category and button purpose.
3362e9c
to
2118516
Compare
After lot of consideration I started implementing parts of the proposed and discussed notification API
For now this includes:
desktop-file-id
propertymarkup-body
propertydisplay-hint
propertynew actions, similar to buttons (the name may be a little confusing, open for suggestions)Part of buttons nowcontent-typecategory
propertycontent-typecategory
,action purposeand button purpose APIThis needs changes in libportal flatpak/libportal#147 for tests.
I also started writing the changes needed in xdg-desktop-portal-gtk: https://github.com/jsparber/xdg-desktop-portal-gtk/tree/implement_notification_v2 and other portal backends need to do the same thing.
Parts that didn't made it from #1304 into this MR may be added it a later revision of the portal.
Fixes: #485