Skip to content

Commit 1529a9a

Browse files
committed
LINUX: Added experimental Wayland support (only if unsafe mode enabled and only for some apps).
MACOS: Tested OK in multi-monitor setups (based on PyWinBox and PyMonCtl features). Fixed Xlib's get_wm_name() not working for some apps/windows. ALL: getDisplay() method returns a list of monitors
1 parent 98f7a5a commit 1529a9a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

dist/PyWinCtl-0.1-py3-none-any.whl

8 Bytes
Binary file not shown.

src/ewmhlib/_ewmhlib.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,11 @@ def getName(self) -> Optional[str]:
10641064
10651065
:return: name of the window as str or None (nothing obtained)
10661066
"""
1067-
return self.xWindow.get_wm_name()
1067+
ret: Optional[Xlib.protocol.request.GetProperty] = self.getProperty(Window.NAME)
1068+
res: Optional[Union[List[int], List[str]]] = getPropertyValue(ret, display=self.display)
1069+
if res:
1070+
return str(res[0])
1071+
return None
10681072

10691073
def setName(self, name: str):
10701074
"""

src/pywinctl/_pywinctl_linux.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import re
1313
import subprocess
1414
import time
15-
from typing import cast, Optional, Union, List, Tuple, Iterable
15+
from typing import cast, Optional, Union, List, Tuple
1616

1717
import Xlib.display
1818
import Xlib.error
@@ -837,6 +837,7 @@ def main():
837837
"""Run this script from command-line to get windows under mouse pointer"""
838838
print("PLATFORM:", sys.platform)
839839
print("ALL WINDOWS", getAllTitles())
840+
print("ALL APPS & WINDOWS", getAllAppsWindowsTitles())
840841
print("MONITORS:", getAllScreens())
841842
npw = getActiveWindow()
842843
if npw is None:

0 commit comments

Comments
 (0)