mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-06 20:15:19 +03:00
add runtime settings for notis
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user