summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-04-13 16:33:13 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-04-13 17:39:42 +0200
commit8232d384929641be7409e026d20843a2edd73e48 (patch)
tree161a56176fcaf77fb9771dade59c6c49a7960f40
parentf67e1d663d61339a7fcb6e0bee0e62d8bba8a3f7 (diff)
downloadqutebrowser-8232d384929641be7409e026d20843a2edd73e48.tar.gz
qutebrowser-8232d384929641be7409e026d20843a2edd73e48.zip
notifications: Handle MaxNotificationsExceeded error from GNOME Flashback
(cherry picked from commit 2cfc64579a22e7dd933c9591e6bb141b877b58e0)
-rw-r--r--qutebrowser/browser/webengine/notification.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/qutebrowser/browser/webengine/notification.py b/qutebrowser/browser/webengine/notification.py
index 36493f4f7..5e32b6327 100644
--- a/qutebrowser/browser/webengine/notification.py
+++ b/qutebrowser/browser/webengine/notification.py
@@ -693,6 +693,15 @@ class DBusNotificationAdapter(AbstractNotificationAdapter):
SPEC_VERSION = "1.2" # Released in January 2011, still current in March 2021.
NAME = "libnotify"
+ _NON_FATAL_ERRORS = {
+ # notification daemon is gone
+ "org.freedesktop.DBus.Error.NoReply",
+
+ # https://gitlab.gnome.org/GNOME/gnome-flashback/-/blob/3.40.0/gnome-flashback/libnotifications/nd-daemon.c#L178-187
+ # Exceeded maximum number of notifications
+ "org.freedesktop.Notifications.MaxNotificationsExceeded",
+ }
+
def __init__(self, parent: QObject = None) -> None:
super().__init__(bridge)
if not qtutils.version_check('5.14'):
@@ -878,8 +887,8 @@ class DBusNotificationAdapter(AbstractNotificationAdapter):
if msg.type() == QDBusMessage.ErrorMessage:
err = msg.errorName()
- if err == "org.freedesktop.DBus.Error.NoReply":
- self.error.emit(msg.errorMessage()) # notification daemon is gone
+ if err in self._NON_FATAL_ERRORS:
+ self.error.emit(msg.errorMessage())
return
raise Error(f"Got DBus error: {err} - {msg.errorMessage()}")