Merge pull request #552 from sileht/master

pulseaudio: hides some error messages
This commit is contained in:
facetoe 2017-03-01 17:24:42 +08:00 committed by GitHub
commit c77d853e14

View File

@ -1,3 +1,4 @@
import os
import re
import subprocess
@ -211,7 +212,11 @@ class PulseAudio(Module, ColorRangeModule):
universal_newlines=True)
for input_index in re.findall('index:\s+(\d+)', sink_inputs):
command = "pacmd move-sink-input {} {}".format(input_index, next_sink)
subprocess.call(command.split())
# Not all applications can be moved and pulseaudio, and when
# this fail pacmd print error messaging
with open(os.devnull, 'w') as devnull:
subprocess.call(command.split(), stdout=devnull)
subprocess.call("pacmd set-default-sink {}".format(next_sink).split())
def switch_mute(self):