Update linux.py

This commit is contained in:
chrys87 2016-09-20 11:11:04 +02:00 committed by GitHub
parent 3c9fff3968
commit 370c34532b

View File

@ -39,11 +39,33 @@ class driver():
print(e)
return xlist
for i in x:
if not "grep" in i:
if not "grep" in i and \
if not "ps" in i:
if (i[:3].lower() == 'tty'):
xlist.append(i[3])
return xlist
return xlist
def getCurrApplication(self):
apps = []
appList = []
try:
apps = subprocess.Popen('ps a -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n')
except Exception as e:
print(e)
return appList
currScreen = str(self.getCurrScreen())
for i in apps:
i = i.split()
i[0] = i[0].lower()
i[1] = i[1].lower()
if '+' in i[2]:
if not "grep" == i[0] and \
not "sh" == i[0] and \
not "ps" == i[0]:
if "tty"+currScreen in i[1]:
appList.append(i[0])
return appList
def update(self, environment, trigger='updateScreen'):
newTTY = ''
newContentBytes = b''