diff --git a/src/gui/MainPane/TopBar.qml b/src/gui/MainPane/TopBar.qml
index 301d961f..b65d3a99 100644
--- a/src/gui/MainPane/TopBar.qml
+++ b/src/gui/MainPane/TopBar.qml
@@ -2,6 +2,7 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
+import ".."
import "../Base"
Rectangle {
@@ -69,12 +70,60 @@ Rectangle {
HButton {
backgroundColor: "transparent"
- icon.name: "reload-config-files"
- toolTip.text: qsTr("Reload config files")
- onClicked: mainUI.reloadSettings()
+ icon.name:
+ window.notificationLevel === Window.NotificationLevel.All ?
+ "notifications-all" :
+
+ window.notificationLevel === Window.NotificationLevel.None ?
+ "notifications-none" :
+
+ "notifications-mentions-keywords"
+
+ icon.color:
+ window.notificationLevel === Window.NotificationLevel.All ?
+ theme.icons.colorize :
+
+ window.notificationLevel === Window.NotificationLevel.None ?
+ theme.colors.negativeBackground :
+
+ theme.colors.middleBackground
+
+ toolTip.text: qsTr("Control global notifications")
+ onClicked: notificationsMenu.open()
Layout.fillHeight: true
+
+ HMenu {
+ id: notificationsMenu
+ y: parent.height
+
+ HMenuItem {
+ icon.name: "notifications-all"
+ text: qsTr("Normal notifications")
+ onTriggered:
+ window.notificationLevel =
+ Window.NotificationLevel.All
+ }
+
+ HMenuItem {
+ icon.name: "notifications-mentions-keywords"
+ icon.color: theme.colors.middleBackground
+ text: qsTr("Mentions & keywords")
+ onTriggered:
+ window.notificationLevel =
+ Window.NotificationLevel.MentionsKeywords
+ }
+
+ HMenuItem {
+ icon.name: "notifications-none"
+ icon.color: theme.colors.negativeBackground
+ text: qsTr("Nothing")
+ onTriggered:
+ window.notificationLevel =
+ Window.NotificationLevel.None
+ }
+ }
}
HButton {
diff --git a/src/gui/PythonBridge/EventHandlers.qml b/src/gui/PythonBridge/EventHandlers.qml
index bb20ac9e..f3378670 100644
--- a/src/gui/PythonBridge/EventHandlers.qml
+++ b/src/gui/PythonBridge/EventHandlers.qml
@@ -12,7 +12,11 @@ QtObject {
}
function onNotificationRequested(title, body, image, highImportance) {
+ const level = window.notificationLevel
+
if (Qt.application.state === Qt.ApplicationActive) return
+ if (level === Window.NotificationLevel.None) return
+ if (level === Window.MentionsKeywords && ! highImportance) return
py.callCoro("desktop_notify", [title, body, image])
diff --git a/src/gui/Window.qml b/src/gui/Window.qml
index ccec70ce..a82b5fd8 100644
--- a/src/gui/Window.qml
+++ b/src/gui/Window.qml
@@ -8,6 +8,8 @@ import "PythonBridge"
ApplicationWindow {
id: window
+ enum NotificationLevel { None, MentionsKeywords, All }
+
// FIXME: Qt 5.13.1 bug, this randomly stops updating after the cursor
// leaves the window until it's clicked again.
@@ -17,6 +19,8 @@ ApplicationWindow {
window.visibility === window.Minimized ||
window.visibility === window.Hidden
+ property int notificationLevel: Window.NotificationLevel.All
+
property var mainUI: null
property var settings: ({})
property var uiState: ({})
diff --git a/src/icons/thin/global-notifications.svg b/src/icons/thin/global-notifications.svg
new file mode 100644
index 00000000..dcebec68
--- /dev/null
+++ b/src/icons/thin/global-notifications.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/icons/thin/notifications-all.svg b/src/icons/thin/notifications-all.svg
new file mode 100644
index 00000000..dcebec68
--- /dev/null
+++ b/src/icons/thin/notifications-all.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/icons/thin/notifications-mentions-keywords.svg b/src/icons/thin/notifications-mentions-keywords.svg
new file mode 100644
index 00000000..9d546b5e
--- /dev/null
+++ b/src/icons/thin/notifications-mentions-keywords.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/icons/thin/notifications-none.svg b/src/icons/thin/notifications-none.svg
new file mode 100644
index 00000000..0c13e326
--- /dev/null
+++ b/src/icons/thin/notifications-none.svg
@@ -0,0 +1,3 @@
+