Open unai-ndz opened 6 years ago
(Not involved in this project, just thought I'd comment) Though I can't speak to why get_wm_name()
is empty (beyond the possibility that it may just be unset), if you didn't know already, in order to get _NET_WM_NAME
(rather than _WM_NAME
) you can use EWMH.getWmName, like:
from ewmh import EWMH
ewmh = EWMH()
windows = ewmh.getClientList()
for w in windows:
# Window name (Title)
print(ewmh.getWmName(w))
print(w.get_wm_class()[1])
Just pure speculation, but I wonder if xprop
would use _NET_WM_NAME
as a fallback, given that - at least on my machine - WM_NAME
is usually of type STRING
, rather than UTF8_STRING
In any case, I believe the get_wm_name
method is actually a method of python-xlib
's Window
(see here), so this problem may be entirely outside of pyewmh
's control.
Indeed, Window.get_wm_name()
is from python-xlib
, and it reads the WM_NAME
property. It is empty because of bug https://github.com/python-xlib/python-xlib/issues/212
To get the (preferred) _NET_WM_NAME
property, use emwh.EWMH.getWmName(window)
as @creallfluharty suggested
If I run this:
I get:
While running:
xprop | grep WM_NAME
Outputs:and
I have tested this on a new pypenv with ewmh-0.1.6, python-xlib-0.23, six-1.11.0 and Python 3.6.5 I can't test this on others environments or browsers right now, but maybe I'm doing something wrong. Did you have any idea or want more info?