From 421f1e525bdecfd47aaceebb42f0edc4be45538d Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Wed, 25 Dec 2019 13:50:46 +0100 Subject: [PATCH] [modules/pulesaudio] Remove pacmd dependency Experimentally remove dependency for pacmd to enable the pulseaudio module to support pulseaudio daemon in system mode (according to #484). fixes #484 --- bumblebee/modules/pulseaudio.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bumblebee/modules/pulseaudio.py b/bumblebee/modules/pulseaudio.py index 5cdd23c..5951358 100644 --- a/bumblebee/modules/pulseaudio.py +++ b/bumblebee/modules/pulseaudio.py @@ -53,9 +53,9 @@ class Module(bumblebee.engine.Module): self._channel = "sink" if self.name == "pasink" else "source" self._patterns = [ - {"expr": "name:", "callback": (lambda line: False)}, - {"expr": "muted:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True))}, - {"expr": "volume:", "callback": self.getvolume}, + {"expr": "Name:", "callback": (lambda line: False)}, + {"expr": "Mute:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True))}, + {"expr": "Volume:", "callback": self.getvolume}, ] engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd="pavucontrol") @@ -111,8 +111,8 @@ class Module(bumblebee.engine.Module): return True def _default_device(self): - output = bumblebee.util.execute("pacmd stat") - pattern = "Default sink name: " if self.name == "pasink" else "Default source name: " + output = bumblebee.util.execute("pactl info") + pattern = "Default {}: ".format("Sink" if self.name == "pasink" else "Source") for line in output.split("\n"): if line.startswith(pattern): return line.replace(pattern, "") @@ -134,11 +134,11 @@ class Module(bumblebee.engine.Module): channel = "sinks" if self.name == "pasink" else "sources" device = self._default_device() - result = bumblebee.util.execute("pacmd list-{}".format(channel)) + result = bumblebee.util.execute("pactl list {}".format(channel)) found = False for line in result.split("\n"): - if "<"+device+">" in line: + if "Name: {}".format(device) in line: found = True continue if found is False: