diff --git a/dist/PyWinCtl-0.1-py3-none-any.whl b/dist/PyWinCtl-0.1-py3-none-any.whl index 7563cca..cc9be7a 100644 Binary files a/dist/PyWinCtl-0.1-py3-none-any.whl and b/dist/PyWinCtl-0.1-py3-none-any.whl differ diff --git a/src/ewmhlib/_ewmhlib.py b/src/ewmhlib/_ewmhlib.py index 9daaeb4..dc77e0f 100644 --- a/src/ewmhlib/_ewmhlib.py +++ b/src/ewmhlib/_ewmhlib.py @@ -1049,7 +1049,7 @@ def changeProperty(self, prop: Union[str, int], data: Union[List[int], str], :param prop: Property/atom of the event in int or str format :param data: Data related to the event. It can be a string or a list of up to 5 integers :param prop_type: Property type (e.g. X.AnyPropertyType or Xatom.STRING) - :param propMode: whether to Replace/Append/Prepend (Mode.*) the property in relation to the rest of + :param propMode: whether to Replace/Append/Prepend (Mode.*) the property in respect to the rest of existing properties """ changeProperty(self.xWindow, prop, data, prop_type, propMode, self.display) @@ -1076,7 +1076,7 @@ def setName(self, name: str): :param name: new name as string """ - self.xWindow.set_wm_name(name) + self.changeProperty(Window.NAME, name) def getVisibleName(self) -> Optional[str]: """ @@ -2617,6 +2617,7 @@ def findit(hwnd: XWindow) -> None: children = [] for child in children: try: + # This returns empty name in some cases... must use getProperty!!!! ret: Optional[str] = child.get_wm_name() except: ret = None diff --git a/src/pywinctl/_pywinctl_linux.py b/src/pywinctl/_pywinctl_linux.py index 73bf7f5..146514e 100644 --- a/src/pywinctl/_pywinctl_linux.py +++ b/src/pywinctl/_pywinctl_linux.py @@ -23,7 +23,7 @@ import Xlib.ext from Xlib.xobject.drawable import Window as XWindow -from pywinctl._main import BaseWindow, Re, _WatchDog, _findMonitorName, getAllScreens, getScreenSize, getWorkArea, displayWindowsUnderMouse +from ._main import BaseWindow, Re, _WatchDog, _findMonitorName, getAllScreens, getScreenSize, getWorkArea, displayWindowsUnderMouse from pywinbox import Box, Size, Point, Rect, pointInBox from ewmhlib import Props, RootWindow, EwmhWindow, defaultRootWindow from ewmhlib._ewmhlib import _xlibGetAllWindows @@ -50,12 +50,14 @@ def getActiveWindow() -> Optional[LinuxWindow]: """ Get the currently active (focused) Window in default root + WAYLAND This will not work on Wayland unless you activate unsafe_mode: - Press alt + f2 - write "lg" (without the quotation marks) and press Enter - In the command entry box (at the bottom of the window), write "global.context.unsafe_mode = true" (without the quotation marks) and press Enter - To exit the "lg" program, click on any of the options in the upper right corner, then press Escape (it seems a lg bug!) - You can set unsafe_mode off again by following the same steps, but in this case, using "global.context.unsafe_mode = false" + Anyway, it will not work with all windows (especially built-in/"official" apps do not populate xid nor X-Window object) :return: Window object or None """ @@ -94,12 +96,14 @@ def getAllWindows(): """ Get the list of Window objects for all visible windows in default root + WAYLAND This will not work on Wayland unless you activate unsafe_mode: - Press alt + f2 - write "lg" (without the quotation marks) and press Enter - In the command entry box (at the bottom of the window), write "global.context.unsafe_mode = true" (without the quotation marks) and press Enter - - To exit the "lg" program, click on any of the options in the upper right corner, and press Escape (it seems a lg bug!) + - To exit the "lg" program, click on any of the options in the upper right corner, then press Escape (it seems a lg bug!) - You can set unsafe_mode off again by following the same steps, but in this case, using "global.context.unsafe_mode = false" + Anyway, it will not work with all windows (especially built-in/"official" apps do not populate xid nor X-Window object) :return: list of Window objects """