xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.

Opened 3 years ago

Closed 2 years ago

Last modified 16 months ago

#2241 closed defect (fixed)

HTML5 client erroneously fetches keyboard layouts from the browser's language

Reported by: Carlos Solís Owned by: Carlos Solís
Priority: major Milestone: 4.0
Component: html5 Version: 2.5.x
Keywords: Cc:


When connecting to Xpra from the HTML5 client, the system attempts to obtain the keyboard layout from the browser's reported language - unfortunately, in my particular case this is causing wrong guesses, namely:

  • My Firefox browser reports "ES-ar" (Spanish, Argentina) and Xpra's logs report switching to "ar" (Arabic).
  • My Microsoft Edge Browser reports more accurately as "ES-cr" (Spanish, Costa Rica) and Xpra's logs report attempting to switch to a non-existing "cr" layout, causing a failure.

In both cases, this causes the inability to type into any windows. Xterm in particular only seems to display numbers and a few control characters. Not even setting the server to use a specific keyboard layout through the --keyboard-layout=XX command seems to work, as the layout is dynamically switched because of the heuristics detailed above. This bug might have gone unnoticed before, because there are EN and US layouts available by default.

Change History (4)

comment:1 Changed 3 years ago by Antoine Martin

Milestone: 4.0
Priority: minormajor
Status: newassigned

comment:2 Changed 2 years ago by Antoine Martin

Owner: changed from Antoine Martin to Carlos Solís
Status: assignednew

So, the difficulty here is that the browsers return ISO 639-1 codes (see https://stackoverflow.com/questions/5580876/navigator-language-list-of-all-languages) but we need an X11 keymap name (see List all valid kbd layouts, variants and toggle options (to use with setxkbmap)).

The original code was trying to make sure that when we get en_GB then we will use the gb x11 keymap.
For en, we should use us.
And in your case, for ES-ar we should be using es or maybe latam? Is there an ar variant? If so, how do we configure that variant with X11?

So r24878 changes the detection code to do that, using the primary language and adding entries to the existing LANGUAGE_TO_LAYOUT lookup table.
I couldn't see an easy way of automatically mapping the ISO codes to X11 layouts... so I did it by hand: r24879 - that took a while. And it is still incomplete as some locales don't have an obvious X11 language mapping, and new locales may be added to browsers, and some are probably missing from the list I used to begin with...

@csolisr: does that work for you? You can apply the patches by hand, download a new copy of the html5 client code from svn, or use the latest online version here: https://xpra.org/html5/

comment:3 Changed 2 years ago by Antoine Martin

Resolution: fixed
Status: newclosed

Not heard back, closing.

comment:4 Changed 16 months ago by migration script

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2241

Note: See TracTickets for help on using tickets.