Skip to content

Commit

Permalink
- Fix a settings crash where user has no monitors for a moment
Browse files Browse the repository at this point in the history
- Fix audio assist going out of sync with discord state
- Fixes #330
  • Loading branch information
trigg committed Apr 14, 2024
1 parent 5933571 commit d2bacff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions discover_overlay/audio_assist.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ async def get_device_details(self, pulse):
elif sink.mute == 0:
deaf = False

if deaf != self.last_set_deaf:
self.last_set_deaf = deaf
self.discover.set_deaf_async(deaf)
self.last_set_mute = None
# At this point mute is undefined state

for source in await pulse.source_list():
if source.description == self.source:
if source.mute == 1 or source.volume.values[0] == 0.0:
Expand All @@ -103,10 +109,6 @@ async def get_device_details(self, pulse):
self.last_set_mute = mute
self.discover.set_mute_async(mute)

if deaf != self.last_set_deaf:
self.last_set_deaf = deaf
self.discover.set_deaf_async(deaf)

async def print_events(self, pulse, ev):
if not self.enabled:
return
Expand Down
10 changes: 6 additions & 4 deletions discover_overlay/settings_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,12 @@ def populate_monitor_menus(self, _a=None, _b=None):

display = Gdk.Display.get_default()
if "get_n_monitors" in dir(display):
for i in range(0, display.get_n_monitors()):
v.append_text(display.get_monitor(i).get_model())
t.append_text(display.get_monitor(i).get_model())
m.append_text(display.get_monitor(i).get_model())
count_monitors = display.get_n_monitors()
if count_monitors:
for i in range(0, count_monitors):
v.append_text(display.get_monitor(i).get_model())
t.append_text(display.get_monitor(i).get_model())
m.append_text(display.get_monitor(i).get_model())

v.set_active(v_value)
t.set_active(t_value)
Expand Down

0 comments on commit d2bacff

Please sign in to comment.