WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
180813
[GTK] Notifications broken under flatpak and bubblewrap sandbox
https://bugs.webkit.org/show_bug.cgi?id=180813
Summary
[GTK] Notifications broken under flatpak and bubblewrap sandbox
Michael Catanzaro
Reported
2017-12-14 08:05:07 PST
Notifications do not work under Flatpak. We either need to use the notification portal D-Bus API, or (more likely) use GNotification. Carlos Garcia wants to keep support for libnotify, so we should use GNotification if there is a GApplication (which will be required for notifications to work under flatpak), and libnotify otherwise.
Attachments
Add attachment
proposed patch, testcase, etc.
Michael Catanzaro
Comment 1
2019-07-13 15:48:19 PDT
Using GNotification would also help us fix
https://gitlab.gnome.org/GNOME/epiphany/issues/853
.
Michael Catanzaro
Comment 2
2019-07-13 15:50:17 PDT
(In reply to Michael Catanzaro from
comment #1
)
> Using GNotification would also help us fix >
https://gitlab.gnome.org/GNOME/epiphany/issues/853
.
We'll need to create a separate WebKit bug for this if we close this one using direct portal access rather than GNotification. But I think GNotification is the way to go. That kills two birds with one stone.
Patrick Griffis
Comment 3
2019-07-13 17:11:18 PDT
GNotification is highly tied to GApplication. So it is unusable in all cases where the application using WebKitGTK doesn't use GApplication. We already assert that applications using the bubblewrap sandbox use GApplication though so maybe thats a direction we want to move towards?
Patrick Griffis
Comment 4
2019-07-13 17:12:45 PDT
I now realize you covered that but using the portal directly probably avoids the need for GApplication. libnotify is honestly awful, everything it does is main thread blocking for example, so its best to avoid it and let it die.
Michael Catanzaro
Comment 5
2019-07-13 18:24:25 PDT
So libnotify would be only for fallback regardless. To use the portal directly, we'd still need to rely on GtkApplication for the app ID in order to solve epiphany#853 I guess? Matthias previously indicated he'd allow a libnotify-style portal implementation instead of a GApplication-style implementation, but hopefully we won't need that.
Patrick Griffis
Comment 6
2019-07-14 13:26:30 PDT
(In reply to Michael Catanzaro from
comment #5
)
> So libnotify would be only for fallback regardless.
Well, the `org.freedesktop.Notification` service is the fallback. My point is the literal `libnotify` library is bad.
> To use the portal directly, we'd still need to rely on GtkApplication for > the app ID in order to solve epiphany#853 I guess?
No, every flatpak contains its own id. GApplication is not required: flatpak run --command=sh org.gnome.Epiphany/x86_64/master gdbus call -d org.freedesktop.portal.Desktop -e -o /org/freedesktop/portal/desktop -m org.freedesktop.portal.Notification.AddNotification "''" "{'title': <'foo'>, 'body': <'bar'>}" # Works as expected
Michael Catanzaro
Comment 7
2019-07-14 17:24:55 PDT
(In reply to Patrick Griffis from
comment #6
)
> Well, the `org.freedesktop.Notification` service is the fallback. My point > is the literal `libnotify` library is bad.
We could stop using it and use org.freedesktop.Notification directly, of course.
> > To use the portal directly, we'd still need to rely on GtkApplication for > > the app ID in order to solve epiphany#853 I guess? > > No, every flatpak contains its own id. GApplication is not required: > > > flatpak run --command=sh org.gnome.Epiphany/x86_64/master > gdbus call -d org.freedesktop.portal.Desktop -e -o > /org/freedesktop/portal/desktop -m > org.freedesktop.portal.Notification.AddNotification "''" "{'title': <'foo'>, > 'body': <'bar'>}" > # Works as expected
Does WebKit have any way to know the flatpak app ID (other than to hope it's the same as the GtkApplication ID)?
Patrick Griffis
Comment 8
2019-07-14 21:52:23 PDT
(In reply to Michael Catanzaro from
comment #7
)
> Does WebKit have any way to know the flatpak app ID (other than to hope it's > the same as the GtkApplication ID)?
Sure we can parse `/.flatpak-info`.
Michael Catanzaro
Comment 9
2021-06-30 08:00:38 PDT
(In reply to Michael Catanzaro from
comment #0
)
> Carlos Garcia wants to keep support for libnotify, so we should use > GNotification if there is a GApplication (which will be required for > notifications to work under flatpak), and libnotify otherwise.
Since
r279369
we made WebKit crash if the bubblewrap sandbox is enabled but GApplication is not used, so IMO we should just drop use of libnotify. Applications that aren't using GApplication surely do not need desktop notifications. Even WPE applications that don't use GtkApplication should be expected to use GApplication, as they should all be sandboxed.
Michael Catanzaro
Comment 10
2022-05-11 17:25:20 PDT
Notifications seem to work fine currently, except the urgency is not set properly. I wonder if libnotify learned to use portals.
Michael Catanzaro
Comment 11
2022-05-12 08:46:32 PDT
Follow-up bug for GNotification:
bug #240347
Michael Catanzaro
Comment 12
2022-07-28 07:52:39 PDT
(In reply to Michael Catanzaro from
comment #10
)
> Notifications seem to work fine currently, except the urgency is not set > properly. I wonder if libnotify learned to use portals.
I was testing with Epiphany, but Epiphany handles notifications manually using GNotification. Oops.
Patrick Griffis
Comment 13
2022-07-29 12:58:10 PDT
libnotify 0.8 uses the notification portal now. I still agree it should be migrated away from but it probably resolves this issue.
Michael Catanzaro
Comment 14
2022-07-29 13:19:57 PDT
That should certainly resolve this. OK, closing again. P.S. Maybe we could just add an async API to libnotify. Then there wouldn't really be anything wrong with using libnotify anymore? As long as WebKit doesn't block when showing a notification, it's OK? Well, that's a separate issue, for a separate bug report....
Patrick Griffis
Comment 15
2022-07-29 14:16:50 PDT
(In reply to Michael Catanzaro from
comment #14
)
> P.S. Maybe we could just add an async API to libnotify. Then there wouldn't > really be anything wrong with using libnotify anymore? As long as WebKit > doesn't block when showing a notification, it's OK? Well, that's a separate > issue, for a separate bug report....
I think its worth doing. Upstream seemed on the fence if libnotify should add async API though.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug