pyewmh icon indicating copy to clipboard operation
pyewmh copied to clipboard

Empty chromium and chrome get_wm_name.

Open unai-ndz opened this issue 6 years ago • 2 comments

If I run this:

from ewmh import EWMH

ewmh = EWMH()
windows = ewmh.getClientList()

for w in windows:
    # Window name (Title)
    print(w.get_wm_name())
    print(w.get_wm_class()[1])

I get:

Chromium

Google-chrome
Terminal
Xfce4-terminal
~/gits/test_ewmh/test.py (i3close) - Sublime Text
Sublime_text

While running: xprop | grep WM_NAME Outputs:

WM_NAME(UTF8_STRING) = "New Issue · parkouss/pyewmh - Chromium"
_NET_WM_NAME(UTF8_STRING) = "New Issue · parkouss/pyewmh - Chromium"

and

WM_NAME(UTF8_STRING) = "duckduckgo at DuckDuckGo - Google Chrome"
_NET_WM_NAME(UTF8_STRING) = "duckduckgo at DuckDuckGo - Google Chrome"

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?

unai-ndz avatar Jun 16 '18 05:06 unai-ndz

(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.

creallfluharty avatar Jun 09 '20 03:06 creallfluharty

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

MestreLion avatar Jan 24 '23 13:01 MestreLion