mirror of
https://github.com/uowuo/abaddon.git
synced 2026-08-15 05:19:58 +00:00
dont notify if message channel is focused
This commit is contained in:
1 parent
e37901bbbb
commit
a09ad5cec0
3 files changed
+12
No files matched your search
@@ -696,6 +696,14 @@ Glib::RefPtr<Gtk::Application> Abaddon::GetApp() {
|
||||
return m_gtk_app;
|
||||
}
|
||||
|
||||
bool Abaddon::IsMainWindowActive() {
|
||||
return m_main_window->has_toplevel_focus();
|
||||
}
|
||||
|
||||
Snowflake Abaddon::GetActiveChannelID() const noexcept {
|
||||
return m_main_window->GetChatActiveChannel();
|
||||
}
|
||||
|
||||
void Abaddon::ActionConnect() {
|
||||
if (!m_discord.IsStarted())
|
||||
StartDiscord();
|
||||
|
||||
@@ -97,6 +97,8 @@ public:
|
||||
static std::string GetStateCachePath(const std::string &path);
|
||||
|
||||
[[nodiscard]] Glib::RefPtr<Gtk::Application> GetApp();
|
||||
[[nodiscard]] bool IsMainWindowActive();
|
||||
[[nodiscard]] Snowflake GetActiveChannelID() const noexcept;
|
||||
|
||||
protected:
|
||||
void RunFirstTimeDiscordStartup();
|
||||
|
||||
@@ -10,6 +10,8 @@ void Notifications::CheckMessage(const Message &message) {
|
||||
auto &discord = Abaddon::Get().GetDiscordClient();
|
||||
// ignore if the channel is muted
|
||||
if (discord.IsChannelMuted(message.ChannelID)) return;
|
||||
// ignore if focused and message's channel is active
|
||||
if (Abaddon::Get().IsMainWindowActive() && Abaddon::Get().GetActiveChannelID() == message.ChannelID) return;
|
||||
// notify messages in DMs
|
||||
const auto channel = discord.GetChannel(message.ChannelID);
|
||||
if (channel->IsDM()) {
|
||||
|
||||
Reference in new issue
Block a user