我有点麻烦让这个代码工作。基本上,我想要的是检查wmctrl-l的输出是否有这个字符串:“Spotify-”。如果存在,请取消静音。如果它不存在,并且/或wmctrl-l包含一个名为“Spotify”的条目(行尾),那么我想静音。在
大部分代码都在工作,问题是GetWindowsPipe()只输出一行', mode 'rb' at 0x7f7a5f854660>。不知道怎么回事。在
有人能帮我解决这个可能很简单的问题吗?在
代码:import subprocess, time, pdb
def GetWindowsPipe():
pipe = subprocess.Popen("wmctrl -l", shell=True, stdout=subprocess.PIPE).stdout
return pipe
def LowerVolume():
subprocess.Popen("amixer -q set Master mute", shell=True)
print 'Lowering volume'
global volumeIsLow
volumeIsLow = True
def RaiseVolume():
subprocess.Popen("amixer -q set Master unmute", shell=True)
print 'Raising volume'
global volumeIsLow
volumeIsLow = False
def Run():
print 'St