From 937e61a86329d1f680b647b6b9597f8c1ca844f1 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Mon, 5 Jun 2017 15:01:10 +0200 Subject: [PATCH] [modules/pulseaudio] Localization independence In order to (hopefully) achieve localization independence, switch from using pactl for retrieving pulseaudio information to pacmd, which seems to be unaffected by the LANG environment variable. fixes #103 --- bumblebee/modules/pulseaudio.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bumblebee/modules/pulseaudio.py b/bumblebee/modules/pulseaudio.py index 0bf88f4..5cdbac3 100644 --- a/bumblebee/modules/pulseaudio.py +++ b/bumblebee/modules/pulseaudio.py @@ -30,9 +30,9 @@ class Module(bumblebee.engine.Module): channel = "sink" if self.name == "pasink" else "source" self._patterns = [ - { "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 }, + { "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 }, ] engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd="pavucontrol") @@ -64,8 +64,8 @@ class Module(bumblebee.engine.Module): return True def _default_device(self): - output = bumblebee.util.execute("pactl info") - pattern = "Default Sink: " if self.name == "pasink" else "Default Source: " + output = bumblebee.util.execute("pacmd stat") + pattern = "Default sink name: " if self.name == "pasink" else "Default source name: " for line in output.split("\n"): if line.startswith(pattern): return line.replace(pattern, "") @@ -84,7 +84,7 @@ class Module(bumblebee.engine.Module): channel = "sinks" if self.name == "pasink" else "sources" device = self._default_device() - result = bumblebee.util.execute("pactl list {}".format(channel)) + result = bumblebee.util.execute("pacmd list-{}".format(channel)) found = False for line in result.split("\n"):