[output] Ignore empty commands

When receiving a "nop" (None) command, skip it. Otherwise, an exception
is thrown and input processing stops.

Also, remove the "communicate()" call to *not* wait until a process has
finished until resuming input processing. Otherwise, whenever an
external program (pavucontrol, nautilius, ...) is started, any further
input processing is stalled until the program has been closed again.

fixes #24
This commit is contained in:
Tobi-wan Kenobi 2016-11-29 19:35:54 +01:00
parent 4819147410
commit bf381794bd

View file

@ -52,12 +52,13 @@ class Command(object):
self._command = [ self._command ]
for cmd in self._command:
if not cmd: continue
if inspect.ismethod(cmd):
cmd(self._event, self._widget)
else:
c = cmd.format(*args, **kwargs)
DEVNULL = open(os.devnull, 'wb')
subprocess.Popen(shlex.split(c), stdout=DEVNULL, stderr=DEVNULL).communicate()
subprocess.Popen(shlex.split(c), stdout=DEVNULL, stderr=DEVNULL)
class Output(object):
def __init__(self, config):