[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
This commit is contained in:
parent
c31015c296
commit
937e61a863
1 changed files with 6 additions and 6 deletions
|
@ -30,9 +30,9 @@ class Module(bumblebee.engine.Module):
|
||||||
channel = "sink" if self.name == "pasink" else "source"
|
channel = "sink" if self.name == "pasink" else "source"
|
||||||
|
|
||||||
self._patterns = [
|
self._patterns = [
|
||||||
{ "expr": "Name:", "callback": (lambda line: False) },
|
{ "expr": "name:", "callback": (lambda line: False) },
|
||||||
{ "expr": "Mute:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True)) },
|
{ "expr": "muted:", "callback": (lambda line: self.mute(False if " no" in line.lower() else True)) },
|
||||||
{ "expr": "Volume:", "callback": self.getvolume },
|
{ "expr": "volume:", "callback": self.getvolume },
|
||||||
]
|
]
|
||||||
|
|
||||||
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd="pavucontrol")
|
engine.input.register_callback(self, button=bumblebee.input.RIGHT_MOUSE, cmd="pavucontrol")
|
||||||
|
@ -64,8 +64,8 @@ class Module(bumblebee.engine.Module):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _default_device(self):
|
def _default_device(self):
|
||||||
output = bumblebee.util.execute("pactl info")
|
output = bumblebee.util.execute("pacmd stat")
|
||||||
pattern = "Default Sink: " if self.name == "pasink" else "Default Source: "
|
pattern = "Default sink name: " if self.name == "pasink" else "Default source name: "
|
||||||
for line in output.split("\n"):
|
for line in output.split("\n"):
|
||||||
if line.startswith(pattern):
|
if line.startswith(pattern):
|
||||||
return line.replace(pattern, "")
|
return line.replace(pattern, "")
|
||||||
|
@ -84,7 +84,7 @@ class Module(bumblebee.engine.Module):
|
||||||
channel = "sinks" if self.name == "pasink" else "sources"
|
channel = "sinks" if self.name == "pasink" else "sources"
|
||||||
device = self._default_device()
|
device = self._default_device()
|
||||||
|
|
||||||
result = bumblebee.util.execute("pactl list {}".format(channel))
|
result = bumblebee.util.execute("pacmd list-{}".format(channel))
|
||||||
found = False
|
found = False
|
||||||
|
|
||||||
for line in result.split("\n"):
|
for line in result.split("\n"):
|
||||||
|
|
Loading…
Reference in a new issue