Kalmat / PyWinCtl

Cross-Platform module to get info on and control windows on screen
Other
179 stars 19 forks source link

Check for property WM_NAME if _NET_WM_NAME property does not return a value #76

Closed ReaperMantis closed 12 months ago

ReaperMantis commented 12 months ago

It appears not all applications set the _NET_WM_NAME properety to set the window title. _NET_WM_NAME should be preferred, but If not present, use the WM_NAME to retain compatibility with applications that do not set it.

Sources:

modified: src/ewmhlib/Props.py Added the new Window.LEGACY_NAME="WM_NAME" property. This can be used to retain compatibility with older programs that do not set _NET_WM_NAME.

modified: src/ewmhlib/_ewmhlib.py Updated the logic for getName to now check for Window.LEGACY_NAME if the result of checking for Window.NAME does not return a value.

ReaperMantis commented 12 months ago

In my case, both ret and res are both None type for _NET_WM_NAME.

The application I'm using is RetroArch.

I suppose it's possible to have the property defined and set to an empty string deliberately, but at that point, I don't know if I wouldn't expect it to not fall back on the other value. I don't have much experience with these libraries, however. It's possible I'm short sighted but would lean towards bad practice on the application end.