[modules/pulseaudio] Only start daemon if not running
Before starting the pulseaudio daemon, ensure that it is not running by using pulseaudio --check. fixes #542
This commit is contained in:
parent
3431129536
commit
1ddcbc454b
1 changed files with 13 additions and 10 deletions
|
@ -25,16 +25,22 @@ import bumblebee.input
|
|||
import bumblebee.output
|
||||
import bumblebee.engine
|
||||
|
||||
def autostart_daemon():
|
||||
try:
|
||||
bumblebee.util.execute("pulseaudio --check")
|
||||
except Exception:
|
||||
try:
|
||||
bumblebee.util.execute("pulseaudio --start")
|
||||
except:
|
||||
pass
|
||||
|
||||
class Module(bumblebee.engine.Module):
|
||||
def __init__(self, engine, config):
|
||||
super(Module, self).__init__(engine, config,
|
||||
bumblebee.output.Widget(full_text=self.volume)
|
||||
)
|
||||
try:
|
||||
if bumblebee.util.asbool(self.parameter("autostart", False)):
|
||||
bumblebee.util.execute("pulseaudio --start")
|
||||
except Exception:
|
||||
pass
|
||||
if bumblebee.util.asbool(self.parameter("autostart", False)):
|
||||
autostart_daemon()
|
||||
|
||||
self._change = 2
|
||||
self._change = int(self.parameter("percent_change", "2%").strip("%"))
|
||||
|
@ -167,11 +173,8 @@ class Module(bumblebee.engine.Module):
|
|||
except Exception:
|
||||
self._failed = True
|
||||
if bumblebee.util.asbool(self.parameter("autostart", False)):
|
||||
try:
|
||||
bumblebee.util.execute("pulseaudio --start")
|
||||
self.update(widgets)
|
||||
except Exception:
|
||||
pass
|
||||
autostart_daemon()
|
||||
self.update(widgets)
|
||||
|
||||
def state(self, widget):
|
||||
if self._mute:
|
||||
|
|
Loading…
Add table
Reference in a new issue