Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdotool sets _NET_WM_NAME as a STRING when it needs to be set as UTF8_STRING #441

Open
gnab-gib-se opened this issue Nov 5, 2023 · 0 comments

Comments

@gnab-gib-se
Copy link

gnab-gib-se commented Nov 5, 2023

This is odd since #235 has xdotool not searching _NET_WM_NAME, so I'm not sure why it's setting it, but in both cases WM_NAME must be set and searched as ASCII and _NET_WM_NAME must be set and searched as UTF8.

On some window managers having _NET_WM_NAME set as an ASCII STRING results in a blank window title after trying to set the window title with xdotool via:

xdotool set_window --name 'Test' <windowid>

unfortunately the situation isn't any better if you try something like this:

xdotool set_window --name $'\x54\x65\x73\x74' <windowid>

or

xdotool set_window --name $(echo Test | iconv --to-code utf-8) <windowid>

it still ends up setting _NET_WM_NAME as STRING.

While trying to find a workaround I discovered that, annoyingly, wmctrl sets _NET_WM_NAME properly as UTF8_STRING, but it ONLY sets _NET_WM_NAME. Again, xdotool won't search _NET_WM_NAME, and even worse, if your environment supports UTF-8 wmctrl will DELETE the WM_NAME property. This means after using wmctrl, xdotool won't function at all. So wmctrl is out in terms of a workaround if you want to continue to try and use the broken xdotool.

Thankfully xprop can do this properly (hah), but it takes two calls, one to set WM_NAME so xdotool will work, and another to set _NET_WM_NAME so a conforming UTF8 WM will correctly display the window title:

xprop -id <windowid> -set WM_NAME Test
xprop -id <windowid> -f _NET_WM_NAME 8u -set _NET_WM_NAME Test

Sheesh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant