From 93ced92cdaab9d42f7c4c54b7a188f79ea3dba68 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 28 Feb 2021 10:28:29 -0400 Subject: [PATCH] Add Notifications.start_level setting --- src/config/settings.py | 9 +++++++++ src/gui/Window.qml | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/config/settings.py b/src/config/settings.py index 14fa8adb..f2b0b77c 100644 --- a/src/config/settings.py +++ b/src/config/settings.py @@ -40,6 +40,15 @@ class Presence: auto_away_after: int = 60 * 10 class Notifications: + # Default global notification level when starting the application. + # Allows muting (i.e. preventing desktop bubbles, sounds and flashes) + # all notifications in the running client, overriding account settings. + # Can be either: + # - "enable" (notifications will work normally) + # - "highlights_only" (notify only for highlights, e.g. replies, keywords) + # - "mute" (don't notify for anything) + start_level: str = "enable" + # How long in seconds the window will flash in your dock or taskbar when # a new message, which matches a notification push rule with a # flash (lightbulb) action, is posted in a room. diff --git a/src/gui/Window.qml b/src/gui/Window.qml index 7abb6721..a61379ba 100644 --- a/src/gui/Window.qml +++ b/src/gui/Window.qml @@ -21,7 +21,13 @@ ApplicationWindow { window.visibility === window.Minimized || window.visibility === window.Hidden - property int notificationLevel: Window.NotificationLevel.Enable + property int notificationLevel: + py.ready && settings.Notifications.start_level === "highlights_only" ? + Window.NotificationLevel.HighlightsOnly : + py.ready && settings.Notifications.start_level === "mute" ? + Window.NotificationLevel.Mute : + Window.NotificationLevel.Enable + property var notifiedIds: new Set() property var mainUI: null