diff --git a/src/fenrir-package/screenDriver/linux.py b/src/fenrir-package/screenDriver/linux.py index 550ba2f9..83ff4728 100644 --- a/src/fenrir-package/screenDriver/linux.py +++ b/src/fenrir-package/screenDriver/linux.py @@ -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''