mark running sink #324
This commit is contained in:
@@ -837,6 +837,8 @@ class SinkBox(Gtk.Box):
|
|||||||
desc = sink["desc"]
|
desc = sink["desc"]
|
||||||
if len(desc) > 26:
|
if len(desc) > 26:
|
||||||
desc = "{}\u2026".format(desc[:26])
|
desc = "{}\u2026".format(desc[:26])
|
||||||
|
if sink["running"]:
|
||||||
|
desc = f"✓ {desc}"
|
||||||
label = Gtk.Label(desc)
|
label = Gtk.Label(desc)
|
||||||
hbox.pack_start(label, True, True, 0)
|
hbox.pack_start(label, True, True, 0)
|
||||||
eb.add(vbox)
|
eb.add(vbox)
|
||||||
|
@@ -536,11 +536,14 @@ def list_sinks():
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
details = line.split()
|
details = line.split()
|
||||||
name = details[1][1:-1]
|
name = details[1][1:-1]
|
||||||
desc = " ".join(details[2:])[1:-1]
|
desc = " ".join(details[3:])[1:-1]
|
||||||
sinks.append({"name": name, "desc": desc})
|
sink = {"name": name, "desc": desc, "running": True if "Running" in line else False}
|
||||||
|
sinks.append(sink)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
eprint(e)
|
eprint(e)
|
||||||
if nwg_panel.common.commands["pactl"]:
|
|
||||||
|
elif nwg_panel.common.commands["pactl"]:
|
||||||
try:
|
try:
|
||||||
output = cmd2string("pactl list sinks")
|
output = cmd2string("pactl list sinks")
|
||||||
if output:
|
if output:
|
||||||
@@ -557,6 +560,8 @@ def list_sinks():
|
|||||||
sink.update({"name": line.split(": ")[1]})
|
sink.update({"name": line.split(": ")[1]})
|
||||||
elif line.lower().startswith("description"):
|
elif line.lower().startswith("description"):
|
||||||
sink.update({"desc": line.split(": ")[1]})
|
sink.update({"desc": line.split(": ")[1]})
|
||||||
|
elif line.lower().startswith("state"):
|
||||||
|
sink.update({"running": True if "RUNNING" in line else False})
|
||||||
if sink:
|
if sink:
|
||||||
sinks.append(sink)
|
sinks.append(sink)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Reference in New Issue
Block a user