Skip to content

Commit

Permalink
notification: Use categories from xdg desktop notification spec
Browse files Browse the repository at this point in the history
The xdg spec¹ uses slightly different names thus making it hard for apps
to use API in a way that works for portaled and non-portaled use cases.

It also makes things slighlty more consistent as the current call.*
sub-categories (`.incoming`, `.ongoing`) indicate a state while the `im`
category indicates a type (`message`).

1) https://specifications.freedesktop.org/notification-spec/1.2/categories.html

Signed-off-by: Guido Günther <[email protected]>
  • Loading branch information
agx authored and jadahl committed Nov 14, 2024
1 parent bf56e85 commit 0c5a2f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions data/org.freedesktop.portal.Notification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
The following categories are standarized so far:
* ``im.message``
* ``im.received``
Intended for instant messaging apps displaying notifications for new messages.
Expand Down Expand Up @@ -331,7 +331,7 @@
Disable the speakerphone for the ongoing call.
* ``call.missed``
* ``call.unanswered``
Intended to be used by call apps when a call was missed.
Expand Down
4 changes: 2 additions & 2 deletions src/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,11 +877,11 @@ parse_category (GVariantBuilder *builder,
{
const char *category;
const char *supported_categories[] = {
"im.message",
"im.received",
"alarm.ringing",
"call.incoming",
"call.ongoing",
"call.missed",
"call.unanswered",
"weather.warning.extreme",
"cellbroadcast.danger.extreme",
"cellbroadcast.danger.severe",
Expand Down
2 changes: 1 addition & 1 deletion tests/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ test_notification_category (void)

notification_s = "{ 'title': <'test notification 5'>, "
" 'body': <'test notification body 5'>, "
" 'category': <'im.message'>"
" 'category': <'im.received'>"
"}";

run_notification_test ("test5", notification_s, NULL, FALSE);
Expand Down

0 comments on commit 0c5a2f8

Please sign in to comment.