Skip to content

Bluetooth speaker icon #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions modules/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def toggle_mute(self, event):
if current_stream:
current_stream.muted = not current_stream.muted
if current_stream.muted:
self.vol_button.get_child().set_markup(icons.vol_off)
self.on_speaker_changed()
self.progress_bar.add_style_class("muted")
self.vol_label.add_style_class("muted")
else:
Expand All @@ -306,8 +306,22 @@ def on_scroll(self, _, event):
def on_speaker_changed(self, *_):
if not self.audio.speaker:
return

vol_high_icon = icons.vol_high
vol_medium_icon = icons.vol_medium
vol_mute_icon = icons.vol_off
vol_off_icon = icons.vol_mute

if "bluetooth" in self.audio.speaker.icon_name:
vol_high_icon = icons.bluetooth_connected
vol_medium_icon = icons.bluetooth
vol_mute_icon = icons.bluetooth_off
vol_off_icon = icons.bluetooth_disconnected

self.progress_bar.value = self.audio.speaker.volume / 100

if self.audio.speaker.muted:
self.vol_button.get_child().set_markup(icons.vol_off)
self.vol_button.get_child().set_markup(vol_mute_icon)
self.progress_bar.add_style_class("muted")
self.vol_label.add_style_class("muted")
self.set_tooltip_text("Muted")
Expand All @@ -316,13 +330,12 @@ def on_speaker_changed(self, *_):
self.progress_bar.remove_style_class("muted")
self.vol_label.remove_style_class("muted")
self.set_tooltip_text(f"{round(self.audio.speaker.volume)}%")
self.progress_bar.value = self.audio.speaker.volume / 100
if self.audio.speaker.volume > 74:
self.vol_button.get_child().set_markup(icons.vol_high)
self.vol_button.get_child().set_markup(vol_high_icon)
elif self.audio.speaker.volume > 0:
self.vol_button.get_child().set_markup(icons.vol_medium)
self.vol_button.get_child().set_markup(vol_medium_icon)
else:
self.vol_button.get_child().set_markup(icons.vol_mute)
self.vol_button.get_child().set_markup(vol_off_icon)

class MicSmall(Box):
def __init__(self, **kwargs):
Expand Down