UTF-8 encoding XSetClassHint
Thomas Dickey
dickey at his.com
Mon Jan 17 23:32:22 UTC 2022
On Mon, Jan 17, 2022 at 05:03:22PM +0000, Rafał Jopek wrote:
> Hi,
>
> I would like to kindly ask you to provide information
> on whether it is possible to set the UTF-8 encoding for the function `XSetClassHint`
> I have not found any information on this subject anywhere,
> decided to write here, I am sure it is possible, can someone provide an example?
The manual page says that it's "implementation dependent",
and that it applies to "WM_CLASS".
_NET_WM_CLASS would be the corresponding property in EWMH,
https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html
but it's not mentioned there (perhaps a few applications use it anyway).
If you find some application which does use it, XSetClassHint is probably
not the way to update it.
> ```
> XStoreName(xw.dpy, xw.win, xw.win_name);
> XSetIconName(xw.dpy, xw.win, xw.win_name);
>
> XChangeProperty( xw.dpy, xw.win,
> XInternAtom( xw.dpy, "_NET_WM_NAME", False ),
> XInternAtom( xw.dpy, "UTF8_STRING", False ),
> 8, PropModeReplace, ( unsigned char * ) xw.win_name,
> strlen( xw.win_name ) );
> XChangeProperty( xw.dpy, xw.win,
> XInternAtom( xw.dpy, "_NET_WM_ICON_NAME", False ),
> XInternAtom( xw.dpy, "UTF8_STRING", False ),
> 8, PropModeReplace, ( unsigned char * ) xw.win_name,
> strlen( xw.win_name ) );
>
> XClassHint * classhint = XAllocClassHint();
> if( classhint )
> {
> classhint->res_name = classhint->res_class = ( char * ) xw.win_name;
> XSetClassHint( xw.dpy, xw.win, classhint );
> XFree( classhint );
> }
> ```
>
>
> Best regards
> - Rafał
--
Thomas E. Dickey <dickey at invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg/attachments/20220117/3d88128f/attachment.sig>
More information about the xorg
mailing list