From d9741d89b6bdaf6dd2eeacfa1ad6a25f5e9aec48 Mon Sep 17 00:00:00 2001 From: gounux Date: Sat, 5 Oct 2024 19:05:07 +0200 Subject: [PATCH] fix(qchat): play sound only on mention --- qtribu/gui/dck_qchat.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/qtribu/gui/dck_qchat.py b/qtribu/gui/dck_qchat.py index 6323a0d5..d37e90e1 100644 --- a/qtribu/gui/dck_qchat.py +++ b/qtribu/gui/dck_qchat.py @@ -381,6 +381,12 @@ def on_ws_message_received(self, message: str) -> None: .get_plg_settings() .notify_push_duration, ) + + # check if a notification sound should be played + if self.settings.qchat_play_sounds: + play_resource_sound( + self.settings.qchat_ring_tone, self.settings.qchat_sound_volume + ) elif message["author"] == self.settings.author_nickname: item = self.create_message_item( message["author"], @@ -397,15 +403,6 @@ def on_ws_message_received(self, message: str) -> None: self.twg_chat.addTopLevelItem(item) self.twg_chat.scrollToItem(item) - # check if a notification sound should be played - if ( - self.settings.qchat_play_sounds - and message["author"] != self.settings.author_nickname - ): - play_resource_sound( - self.settings.qchat_ring_tone, self.settings.qchat_sound_volume - ) - def handle_internal_message(self, message: dict[str, Any]) -> None: """ Handle an internal message, spotted by its author