diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-04-13 16:33:13 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-04-13 17:38:48 +0200 |
commit | 2cfc64579a22e7dd933c9591e6bb141b877b58e0 (patch) | |
tree | d7d3eab7800df31e6587adee61264d6c3438c5a1 /qutebrowser | |
parent | 9aa8740ec95e147116ec7d868ac2f3bb2e8259be (diff) | |
download | qutebrowser-2cfc64579a22e7dd933c9591e6bb141b877b58e0.tar.gz qutebrowser-2cfc64579a22e7dd933c9591e6bb141b877b58e0.zip |
notifications: Handle MaxNotificationsExceeded error from GNOME Flashback
Diffstat (limited to 'qutebrowser')
-rw-r--r-- | qutebrowser/browser/webengine/notification.py | 13 |
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()}") |