Wednesday, February 01, 2023

Re: Titlebar in firefox and tor-browser

On Tue, 31 Jan 2023 18:05:50 -0500
Morgan Aldridge <morgant@makkintosshu.com> wrote:

> On Tue, Jan 31, 2023 at 5:20 PM Julian Smith <jules@op59.net> wrote:
> >
> > On OpenBSD 7.2 with Fvwm2 (fvwm2-2.6.9p1), Firefox (firefox-107.0)
> > and Tor-browser (tor-browser-11.5.6) both appear to not set the
> > window titlebar to the current tab's text.
> >
> > Instead, the titlebar is always set to "Mozilla Firefox" or "Tor
> > Browser".
> >
> > Is this expected? Is there any way to make the titlebar show the
> > current Tab's text?
> >
> > I think OpenBSD 7.0 used to set the titlebar text as expected. I
> > had a look in /usr/ports/www/mozilla-firefox/, but couldn't see
> > anything obvious.
>
> I can confirm this same functionality on amd64/7.2-stable with MLVWM
> (mlvwm-0.9.3) and Firefox (firefox-107.0.1). As the MLVWM developer
> (and port maintainer), I know that it, like fvwm in base, only draws
> the window title from `WM_TITLE` (C_STRING, STRING, or
> COMPOUND_STRING), not the newer `_NET_WM_NAME` (UTF8_STRING)
> extension. Due to incompatible licensing, I haven't perused the source
> for fvwm2 from ports, so it might differ. My guess is that Firefox has
> stopped setting `WM_TITLE` with the tab name and only sets it in the
> UTF-8 `_NET_WM_NAME`.
>
> I ran into a related regression in SDL[0][1] a while ago, which has
> since been fixed, where they stopped setting `WM_TITLE` because they
> felt it was superseded by `_NET_WM_NAME`. According to the ICCCM spec,
> `WM_TITLE` should always be set, and for window managers supporting
> NetWM/EWMH (Extended Window Manager Hints) where `X_HAVE_UTF8_STRING`,
> the window manager should use `_NET_WM_NAME` instead. Unfortunately,
> many application developers have decided (incorrectly, IMHO) that this
> means `_NET_WM_NAME` replaces `WM_TITLE` and doesn't need to be set
> anymore (because it's harder... it's not UTF-8, so they have to check
> encodings and encode the string correctly & appropriately.) I know
> Thomas Adam, one of the fvwm3 developers, and I have discussed this
> particular interpretation before too.
>
> Running `xprop` on a Firefox window with the OpenBSD homepage loaded
> confirms my suspicions:
>
> WM_NAME(STRING) = "Mozilla Firefox"
> _NET_WM_NAME(UTF8_STRING) = "OpenBSD — Mozilla Firefox"
>
> So, I'd suggest submitting a bug report upstream w/Firefox. (I believe
> the Firefox codebase is used for Thunderbird, as well, so I suspect
> this issue affects it too.)

Many thanks for this. I get the same results with xprop.

I had a look for WM_NAME and there's already a Firefox bug for this:
https://bugzilla.mozilla.org/show_bug.cgi?id=1679182.

One of the comments mentions a suggested workaround is to set
LC_ALL=en_US.UTF-8, and this fixes the problem for me:

LC_ALL=en_US.UTF-8 firefox

(I think https://www.openbsd.org/faq/faq10.html implies that
`en_US.UTF-8` is supported on OpenBSD, but any suggestions about a
better workaround would be welcome.)

More generally, it looks like the problem is caused by Firefox
changing around version 0.83 to using a non-ascii dash in its titlebar
text.

It uses `gtk_window_set_title()` to set the titlebar. I guess the
implication is that GTK is not setting WM_NAME if the text is not pure
ascii and the locale is not utf8. It looks like gtk2 is obsolete
though, so i haven't submitted a bug report.

BTW i tried fvwm3 but it doesn't appear to behave differently from
fvwm2 here.

- Julian

--
http://op59.net/

No comments:

Post a Comment