summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/notifications/notifications.cpp1
-rw-r--r--src/notifications/notifier_gio.cpp4
-rw-r--r--src/settings.cpp4
-rw-r--r--src/settings.hpp8
4 files changed, 16 insertions, 1 deletions
diff --git a/src/notifications/notifications.cpp b/src/notifications/notifications.cpp
index 5b834ce..3c88c44 100644
--- a/src/notifications/notifications.cpp
+++ b/src/notifications/notifications.cpp
@@ -87,6 +87,7 @@ bool CheckGuildMessage(const Message &message) {
}
void Notifications::CheckMessage(const Message &message) {
+ if (!Abaddon::Get().GetSettings().NotificationsEnabled) return;
// ignore if our status is do not disturb
if (IsDND()) return;
auto &discord = Abaddon::Get().GetDiscordClient();
diff --git a/src/notifications/notifier_gio.cpp b/src/notifications/notifier_gio.cpp
index ed17ad1..22d4c87 100644
--- a/src/notifications/notifier_gio.cpp
+++ b/src/notifications/notifier_gio.cpp
@@ -35,7 +35,9 @@ void Notifier::Notify(const Glib::ustring &id, const Glib::ustring &title, const
g_object_unref(file);
#ifdef ENABLE_NOTIFICATION_SOUNDS
- ma_engine_play_sound(&m_engine, Abaddon::Get().GetResPath("/sound/message.mp3").c_str(), nullptr);
+ if (Abaddon::Get().GetSettings().NotificationsPlaySound) {
+ ma_engine_play_sound(&m_engine, Abaddon::Get().GetResPath("/sound/message.mp3").c_str(), nullptr);
+ }
#endif
}
diff --git a/src/settings.cpp b/src/settings.cpp
index c1a2fd2..82401f5 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -68,6 +68,8 @@ void SettingsManager::ReadSettings() {
SMSTR("style", "mentionbadgecolor", MentionBadgeColor);
SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor);
SMSTR("style", "unreadcolor", UnreadIndicatorColor);
+ SMBOOL("notifications", "enabled", NotificationsEnabled);
+ SMBOOL("notifications", "playsound", NotificationsPlaySound);
#ifdef WITH_KEYCHAIN
keychain::Error error {};
@@ -149,6 +151,8 @@ void SettingsManager::Close() {
SMSTR("style", "mentionbadgecolor", MentionBadgeColor);
SMSTR("style", "mentionbadgetextcolor", MentionBadgeTextColor);
SMSTR("style", "unreadcolor", UnreadIndicatorColor);
+ SMBOOL("notifications", "enabled", NotificationsEnabled);
+ SMBOOL("notifications", "playsound", NotificationsPlaySound);
#ifdef WITH_KEYCHAIN
keychain::Error error {};
diff --git a/src/settings.hpp b/src/settings.hpp
index 9d32d2e..53f3423 100644
--- a/src/settings.hpp
+++ b/src/settings.hpp
@@ -44,6 +44,14 @@ public:
std::string MentionBadgeColor { "#b82525" };
std::string MentionBadgeTextColor { "#fbfbfb" };
std::string UnreadIndicatorColor { "#ffffff" };
+
+ // [notifications]
+#ifdef _WIN32
+ bool NotificationsEnabled { false };
+#else
+ bool NotificationsEnabled { true };
+#endif
+ bool NotificationsPlaySound { true };
};
SettingsManager(const std::string &filename);