From 28bca125e6694aed67b4a64914f74c4dfae00873 Mon Sep 17 00:00:00 2001 From: Sandaru Jayasekara Date: Sat, 8 Jun 2024 12:52:32 +0530 Subject: [PATCH] Accurately display mute status when using volume icon or emoji --- libqtile/widget/volume.py | 4 ++-- test/widgets/test_volume.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libqtile/widget/volume.py b/libqtile/widget/volume.py index 25d8581606..fd61c4ddd6 100644 --- a/libqtile/widget/volume.py +++ b/libqtile/widget/volume.py @@ -165,7 +165,7 @@ def _update_drawer(self): if self.theme_path: self.drawer.clear(self.background or self.bar.background) - if self.volume <= 0: + if self.volume <= 0 or self.is_mute: img_name = "audio-volume-muted" elif self.volume <= 30: img_name = "audio-volume-low" @@ -183,7 +183,7 @@ def _update_drawer(self): "Emoji list given has less than 4 items. Falling back to default emojis." ) - if self.volume <= 0: + if self.volume <= 0 or self.is_mute: self.text = self.emoji_list[0] elif self.volume <= 30: self.text = self.emoji_list[1] diff --git a/test/widgets/test_volume.py b/test/widgets/test_volume.py index 9dc26cf8c3..0ade89891a 100644 --- a/test/widgets/test_volume.py +++ b/test/widgets/test_volume.py @@ -51,6 +51,10 @@ def test_emoji(): vol._update_drawer() assert vol.text == "\U0001f50a" + vol.is_mute = True + vol._update_drawer() + assert vol.text == "\U0001f507" + def test_text(): fmt = "Volume: {}"