Update linux.py
This commit is contained in:
parent
8e445bfa86
commit
45186d7e6d
@ -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)
|
||||||
|
try:
|
||||||
for i in apps:
|
for i in apps:
|
||||||
|
i = i.upper()
|
||||||
i = i.split()
|
i = i.split()
|
||||||
i[0] = i[0].lower()
|
i[0] = i[0]
|
||||||
i[1] = i[1].lower()
|
i[1] = i[1]
|
||||||
if '+' in i[2]:
|
if '+' in i[2]:
|
||||||
if not "grep" == i[0] and \
|
if i[0] != '':
|
||||||
not "sh" == i[0] and \
|
if not "GREP" == i[0] and \
|
||||||
not "ps" == i[0]:
|
not "SH" == i[0] and \
|
||||||
if "tty"+currScreen in i[1]:
|
not "PS" == i[0]:
|
||||||
appList.append(i[0].upper())
|
if "TTY"+currScreen in i[1]:
|
||||||
return appList
|
return i[0]
|
||||||
|
except:
|
||||||
|
return ''
|
||||||
|
return ''
|
||||||
|
|
||||||
def getIgnoreScreens(self):
|
def getIgnoreScreens(self):
|
||||||
xlist = []
|
xlist = []
|
||||||
|
Loading…
Reference in New Issue
Block a user