Skip to content

Commit

Permalink
Accurately display mute status when using volume icon or emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
SandaruLJ authored and tych0 committed Jun 10, 2024
1 parent b7cb03a commit 28bca12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libqtile/widget/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions test/widgets/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}"
Expand Down

0 comments on commit 28bca12

Please sign in to comment.