Skip to content

Commit

Permalink
ALL: Added getAllWindowsDict() general function. Added getPID() method.
Browse files Browse the repository at this point in the history
LINUX: Added bad window filter to check for window.id == 0
  • Loading branch information
Kalmat committed Sep 23, 2024
1 parent 64dd85d commit a76999f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/pywinctl/_pywinctl_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,9 +799,9 @@ def getHandle(self) -> int:

def getPID(self) -> Optional[int]:
"""
Get the current application PID
Get the current application PID the window belongs to
:return: application PID
:return: application PID or None if it couldn't be retrieved
"""
return self._win.getPid()

Expand Down
4 changes: 2 additions & 2 deletions src/pywinctl/_pywinctl_macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,9 +1143,9 @@ def getHandle(self) -> Tuple[str, str]:

def getPID(self) -> Optional[int]:
"""
Get the current application PID
Get the current application PID the window belongs to
:return: application PID
:return: application PID or None if it couldn't be retrieved
"""
cmd = """osascript -s 's' -e 'tell application "System Events"
set appPID to "0"
Expand Down
4 changes: 2 additions & 2 deletions src/pywinctl/_pywinctl_win.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,9 @@ def getHandle(self) -> int:

def getPID(self) -> Optional[int]:
"""
Get the current application PID
Get the current application PID the window belongs to
:return: application PID
:return: application PID or None if it couldn't be retrieved
"""
ret = win32process.GetWindowThreadProcessId(self._hWnd)
if ret and len(ret) > 1:
Expand Down

0 comments on commit a76999f

Please sign in to comment.