[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    Re: UTF-8 encoding XSetClassHint
From:       Thomas Dickey <dickey () his ! com>
Date:       2022-01-17 23:32:22
Message-ID: 20220117233222.GA22000 () prl-debianold-64 ! jexium-island ! net
[Download RAW message or body]


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@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic