File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -826,7 +826,17 @@ def getAppName(self) -> str:
826826 :return: name of the app as string
827827 """
828828 # https://stackoverflow.com/questions/32295395/how-to-get-the-process-name-by-pid-in-linux-using-python
829- pid = EWMH .getWmPid (self ._hWnd )
829+ try :
830+ pid : int | None = EWMH .getWmPid (self ._hWnd )
831+ # Workaround a bug in ewmh. Fixed upstream but never released
832+ # See https://github.com/parkouss/pyewmh/commit/acd58697
833+ except TypeError :
834+ return ""
835+
836+ # if the above fix is ever released, EWMH.getWmPid() might return None
837+ if pid is None :
838+ return ""
839+
830840 with subprocess .Popen (f"ps -q { pid } -o comm=" , shell = True , stdout = subprocess .PIPE ) as p :
831841 stdout , stderr = p .communicate ()
832842 return stdout .decode (encoding = "utf8" ).replace ("\n " , "" )
You can’t perform that action at this time.
0 commit comments