From 532b3628d395be4b4cda275f6e0f6809b8762be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Geoffrey=20=E2=80=9CFrogeye=E2=80=9D=20Preud=27homme?= Date: Mon, 2 Sep 2024 16:26:40 +0200 Subject: [PATCH] frobar: More pulseaudio device descriptions Is there not a standard thing I can check? --- hm/desktop/frobar/frobar/providers.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hm/desktop/frobar/frobar/providers.py b/hm/desktop/frobar/frobar/providers.py index e0a32f8..c4dca97 100644 --- a/hm/desktop/frobar/frobar/providers.py +++ b/hm/desktop/frobar/frobar/providers.py @@ -274,9 +274,15 @@ class PulseaudioProvider(StatefulSection, ThreadedUpdater): sinks = [] with pulsectl.Pulse("list-sinks") as pulse: for sink in pulse.sink_list(): - if sink.port_active.name == "analog-output-headphones": + if ( + sink.port_active.name == "analog-output-headphones" + or sink.port_active.description == "Headphones" + ): icon = "" - elif sink.port_active.name == "analog-output-speaker": + elif ( + sink.port_active.name == "analog-output-speaker" + or sink.port_active.description == "Speaker" + ): icon = "" if sink.mute else "" elif sink.port_active.name in ("headset-output", "headphone-output"): icon = "" @@ -868,8 +874,7 @@ class MprisProvider(Section, ThreadedUpdater): "{{ playerName }} {{ status }}", "{{ album }}", "{{ artist }}", - "{{ duration(position) }}|{{ duration(mpris:length) }}" - " {{ title }}", + "{{ duration(position) }}|{{ duration(mpris:length) }}" " {{ title }}", ] # nf-fd icons don't work (UTF-16?) @@ -942,3 +947,8 @@ class MprisProvider(Section, ThreadedUpdater): while p.poll() is None: self.line = p.stdout.readline().decode().strip() self.refreshData() + p = subprocess.Popen(cmd, stdout=subprocess.PIPE) + assert p.stdout + while p.poll() is None: + self.line = p.stdout.readline().decode().strip() + self.refreshData()