Update linux.py
This commit is contained in:
parent
3c9fff3968
commit
370c34532b
@ -39,11 +39,33 @@ class driver():
|
|||||||
print(e)
|
print(e)
|
||||||
return xlist
|
return xlist
|
||||||
for i in x:
|
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'):
|
if (i[:3].lower() == 'tty'):
|
||||||
xlist.append(i[3])
|
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'):
|
def update(self, environment, trigger='updateScreen'):
|
||||||
newTTY = ''
|
newTTY = ''
|
||||||
newContentBytes = b''
|
newContentBytes = b''
|
||||||
|
Loading…
Reference in New Issue
Block a user