Update linux.py

This commit is contained in:
chrys87 2016-09-23 11:15:42 +02:00 committed by GitHub
parent 8e445bfa86
commit 45186d7e6d

View File

@ -30,24 +30,28 @@ class driver():
def getCurrApplication(self, screen): def getCurrApplication(self, screen):
apps = [] apps = []
appList = []
try: try:
apps = subprocess.Popen('ps a -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') apps = subprocess.Popen('ps a -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n')
except Exception as e: except Exception as e:
print(e) print(e)
return appList return ''
currScreen = str(screen) currScreen = str(screen)
for i in apps: try:
i = i.split() for i in apps:
i[0] = i[0].lower() i = i.upper()
i[1] = i[1].lower() i = i.split()
if '+' in i[2]: i[0] = i[0]
if not "grep" == i[0] and \ i[1] = i[1]
not "sh" == i[0] and \ if '+' in i[2]:
not "ps" == i[0]: if i[0] != '':
if "tty"+currScreen in i[1]: if not "GREP" == i[0] and \
appList.append(i[0].upper()) not "SH" == i[0] and \
return appList not "PS" == i[0]:
if "TTY"+currScreen in i[1]:
return i[0]
except:
return ''
return ''
def getIgnoreScreens(self): def getIgnoreScreens(self):
xlist = [] xlist = []