Expose the WM_NAME property #75
Replies: 5 comments 1 reply
-
Hi! Don't know which version of PyWinCtl you are using but, except for versions v0.0.45 and v0.0.50 (*), it is already querying
If you are in one of those versions, please upgrade to last version (v0.1) and check if it is OK in your case. If not, please let me know (**). (*) I was using Xlib's PS: Just for information, Wayland also works using "_NET_WM_NAME" property, but doesn't allow to retrieve the active window nor the list of open windows, so PyWinCtl will not work unless you instantiate |
Beta Was this translation helpful? Give feedback.
-
Sorry, I didnt include any information on what I was using! KDE Neon 5.27 I've tried:
The output is: I check with the debugger and it's None type. When I go through xlib using |
Beta Was this translation helpful? Give feedback.
-
Maybe something strange is going on. I checked ewmhlib.py, and _NET_WM_NAME is indeed there, and that is what's used with the getProperty(Window.NAME). If I use pip to install pywinctl I get None for the title. In all cases, if I use self._win.display.create_resource_object('window',self._hWnd).get_wm_name() in pywinctl_linux.py, I always get the correct title. Maybe my venv has something different than what my system has... Note: this is only happening for one application. Most other applications always return the title. |
Beta Was this translation helpful? Give feedback.
-
_NET_WM_NAME and WM_NAME appear to be different. It might be the solution to prefer _NET_WM_NAME and fall back on WM_NAME if the former does not return a result. I added a LEGACY_NAME property to Window in the Prop file, and then in _ewmhlib.py look for Window.NAME, if not available, look for WM_NAME, otherwise None. That seems like the most elegant solution to what I need, thank you for pointing me in the direction of _ewmhlib.py. |
Beta Was this translation helpful? Give feedback.
-
Hi! So happy you found a solution!! I will include that fix in my next version too! Just to be sure, can you please paste your code? Did you manage to clarify what may be happening in your environent when installing PyWinCtl (or other modules) in a different way? (To be honest, I was affraid that I made a mistake when uploading the wheel to PyPi, but inspecting it after downloading, it seems ok!) Thank you! |
Beta Was this translation helpful? Give feedback.
-
Is there any interest in exposing the WM_NAME property?
This is a great library for getting a hold of windows, their properties, and some basic quick controls. It gets me 90% of where I need to be out of the box.
I've got an application that I run that doesn't like to populate the "Title" property. It instead uses the WM_NAME. I've crudely mocked it up to be exposed in a local repository, but for Linux/X11 only. I'm not sure what it would look like on Wayland, Windows, or Mac.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions