Thank you so much Страхиња Радић! 

This works perfectly. 
André.

On 10/07/2023  9:35, Страхиња Радић wrote:
> I managed to fix root window title being shown incorrectly by skipping 
> conversion only for root window. I attached a patch with this message. Feel 
> free to review it, I will make any necessary corrections.

> From c5b399e138f6873e2eb9a292d55c5382e654f074 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=D0=A1=D1=82=D1=80=D0=B0=D1=85=D0=B8=D1=9A=D0=B0=20=D0=A0?=
>  =?UTF-8?q?=D0=B0=D0=B4=D0=B8=D1=9B?= <cont...@strahinja.org>
> Date: Mon, 10 Jul 2023 09:25:30 +0200
> Subject: [PATCH] dwm.c: Always convert title to UTF-8, except for root window
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Window names containing only ISO 8859-1 were broken on the location of
> non-ASCII ISO 8859-1 character, for example áâãéíóôúç, because they were
> treated as UTF-8. When commenting out the if-branch testing for XA_STRING, 
> root
> window title, usually set by status programs such as slstatus to UTF-8 text,
> was not shown correctly, so this patch adds an exception for root window
> instead, skipping conversion in that case.
> 
> Reported by Dr. André Desgualdo Pereira.
> 
> Signed-off-by: Страхиња Радић <cont...@strahinja.org>
> ---
>  dwm.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/dwm.c b/dwm.c
> index f1d86b2..c896325 100644
> --- a/dwm.c
> +++ b/dwm.c
> @@ -917,7 +917,10 @@ gettextprop(Window w, Atom atom, char *text, unsigned 
> int size)
>       text[0] = '\0';
>       if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems)
>               return 0;
> -     if (name.encoding == XA_STRING) {
> +     /*if (name.encoding == XA_STRING) {
> +             strncpy(text, (char *)name.value, size - 1);
> +     } else */
> +     if (w == DefaultRootWindow(dpy)) {
>               strncpy(text, (char *)name.value, size - 1);
>       } else if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success 
> && n > 0 && *list) {
>               strncpy(text, *list, size - 1);
> -- 
> 2.38.5
> 



-- 
Dr. André Desgualdo Pereira
Psiquiatra - CRM/SP: 120218 - RQE: 61032
WhatsApp: (11) 985-847-809 - email: des...@gmail.com
Consultório Lapa: Rua Clélia, 2208 - sala 307
Consultório Santana: Av. Gen. Ataliba Leonel, 93 - sala 61

Reply via email to