Skip to content

keyboardManager: don't append locale layout if already present#13616

Open
Fizmatik wants to merge 1 commit intolinuxmint:masterfrom
Fizmatik:fix/keyboard-duplicate-locale-layout
Open

keyboardManager: don't append locale layout if already present#13616
Fizmatik wants to merge 1 commit intolinuxmint:masterfrom
Fizmatik:fix/keyboard-duplicate-locale-layout

Conversation

@Fizmatik
Copy link

@Fizmatik Fizmatik commented Mar 3, 2026

Problem

_buildGroupStrings() in js/ui/keyboardManager.js unconditionally appends the locale-derived layout (from _getLocaleLayout()) to every XKB group via .concat(this._localeLayoutInfo).

When the user's configured layouts already include the locale layout (e.g. ru layout with ru_RU.UTF-8 locale), this produces duplicates — setxkbmap reports us,ru,ru instead of us,ru, adding a phantom third layout to the switcher.

This affects all users whose system locale matches one of their configured keyboard layouts (common for Russian, Ukrainian, German, French, and many other non-English locales).

Steps to reproduce

  1. Set system locale to ru_RU.UTF-8 (or any non-English locale)
  2. Configure keyboard layouts: English (US) + Russian
  3. Check with setxkbmap -query

Expected: layout: us,ru
Actual: layout: us,ru,ru

Fix

Check whether the locale layout is already present in the group before appending it. This preserves the original intent (ensuring a locale layout slot is always available for toolkit mnemonics) while avoiding duplication.

Testing

Tested on Linux Mint 22 Cinnamon (cinnamon 6.6.7, locale ru_RU.UTF-8). After the fix, setxkbmap -query correctly reports us,ru and the layout switcher shows exactly two layouts.

_buildGroupStrings() unconditionally appends the locale-derived layout
to the XKB group. When the user's configured layouts already include
the locale layout (e.g. 'ru' with ru_RU.UTF-8 locale), this produces
duplicates like 'us,ru,ru', adding a phantom third layout to the
switcher.

Check whether the locale layout is already present before appending it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant