@@ -66,13 +66,16 @@ def open_lock(*args):
6666
6767 return fp
6868
69- def run (cmd , check = True ):
69+ def run (cmd , * , check = True , block = True ):
7070 'Run subprocess function and return standard output or None'
7171 # Maintain subprocess compatibility with python 3.4 so use
7272 # check_output() rather than run().
7373 try :
74- stdout = subprocess .check_output (cmd , universal_newlines = True ,
75- stderr = (None if check else subprocess .DEVNULL ))
74+ if block :
75+ stdout = subprocess .check_output (cmd , universal_newlines = True ,
76+ stderr = (None if check else subprocess .DEVNULL ))
77+ else :
78+ stdout = subprocess .Popen (cmd )
7679 except Exception as e :
7780 stdout = None
7881 if check :
@@ -173,7 +176,7 @@ class COMMAND:
173176
174177 def run (self ):
175178 'Run this command + arguments'
176- run (self .argslist )
179+ run (self .argslist , block = False )
177180
178181 def __str__ (self ):
179182 'Return string representation'
@@ -248,7 +251,7 @@ class COMMAND_internal(COMMAND):
248251
249252 # Switch to desired workspace
250253 if index >= minindex and index < maxindex :
251- run (('wmctrl' , '-s' , str (index )))
254+ run (('wmctrl' , '-s' , str (index )), block = False )
252255
253256# Table of gesture handlers
254257handlers = OrderedDict ()
@@ -530,7 +533,8 @@ if args.verbose:
530533 print ('Gestures configured in {}:' .format (confname ))
531534 for h in handlers .values ():
532535 for mpair , cmd in h .motions .items ():
533- motion , fingers = (mpair , '' ) if isinstance (mpair , str ) else mpair
536+ motion , fingers = (mpair , '' ) \
537+ if isinstance (mpair , str ) else mpair
534538 print ('{} {:10}{:>2} {}' .format (h .name .lower (), motion ,
535539 fingers , cmd ))
536540
0 commit comments