Add Notifications.start_level setting

This commit is contained in:
miruka 2021-02-28 10:28:29 -04:00
parent 9c56e78164
commit 93ced92cda
2 changed files with 16 additions and 1 deletions

View File

@ -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.

View File

@ -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