diff --git a/nwg_panel/modules/controls.py b/nwg_panel/modules/controls.py index 4e28e69..bc1aebe 100644 --- a/nwg_panel/modules/controls.py +++ b/nwg_panel/modules/controls.py @@ -837,6 +837,8 @@ class SinkBox(Gtk.Box): desc = sink["desc"] if len(desc) > 26: desc = "{}\u2026".format(desc[:26]) + if sink["running"]: + desc = f"✓ {desc}" label = Gtk.Label(desc) hbox.pack_start(label, True, True, 0) eb.add(vbox) diff --git a/nwg_panel/tools.py b/nwg_panel/tools.py index 1e23356..b8d2ed7 100644 --- a/nwg_panel/tools.py +++ b/nwg_panel/tools.py @@ -536,11 +536,14 @@ def list_sinks(): for line in lines: details = line.split() name = details[1][1:-1] - desc = " ".join(details[2:])[1:-1] - sinks.append({"name": name, "desc": desc}) + desc = " ".join(details[3:])[1:-1] + sink = {"name": name, "desc": desc, "running": True if "Running" in line else False} + sinks.append(sink) + except Exception as e: eprint(e) - if nwg_panel.common.commands["pactl"]: + + elif nwg_panel.common.commands["pactl"]: try: output = cmd2string("pactl list sinks") if output: @@ -557,6 +560,8 @@ def list_sinks(): sink.update({"name": line.split(": ")[1]}) elif line.lower().startswith("description"): sink.update({"desc": line.split(": ")[1]}) + elif line.lower().startswith("state"): + sink.update({"running": True if "RUNNING" in line else False}) if sink: sinks.append(sink) except Exception as e: