Always adding the default input source for the current locale can have awkward results
GNOME Shell's input source handling code does something interesting. When applying a configuration, it seems to always add the default input source for the current locale:
_applyLayoutGroup(group) {
let options = this._buildOptionsString();
let [layouts, variants] = this._buildGroupStrings(group);
...
combined with:
_buildGroupStrings(_group) {
let group = _group.concat(this._localeLayoutInfo);
let layouts = group.map(g => g.layout).join(',');
let variants = group.map(g => g.variant).join(',');
return [layouts, variants];
}
note how _buildGroupStrings
always concatenates this._localeLayoutInfo
(which is the result of this._getLocaleLayout()
) into the config to be applied, and _applyLayoutGroup
uses _buildGroupStrings
.
I believe the rationale for this was explained by Rui Matos in a comment added in 8589bfb6 (which introduced this code), that is still present:
// We need to leave one slot on each group free so that we
// can add a layout containing the symbols for the
// language used in UI strings to ensure that toolkits can
// handle mnemonics like Alt+Ф even if the user is
// actually typing in a different layout.
That kinda makes sense, sure, but this has odd effects when there are multiple possible input sources for a given locale and the user happens to want to use one which isn't gnome-desktop's idea of the "default" for that locale. For instance, Bulgarian!
If you boot a current Fedora Rawhide live (so you see the new, not-yet-upstream gnome-initial-setup live boot flow) and set the locale to Bulgarian on the first page, on the second page, you'll get a choice of several Bulgarian keyboard layouts. The default is "traditional phonetic". The others are a "new phonetic" layout and both old and new non-phonetic layouts, I believe. ("Phonetic" layouts kinda follow the QWERTY layout, but with Cyrillic characters - each key is mapped to a similar-sounding Cyrillic character, so e.g. the Cyrillic 'c', which is a sound similar to a Latin 's', is on the key that's "s" on a QWERTY keyboard).
If you pick anything other than the default "traditional phonetic" layout, then select "Try" on the final screen of g-i-s so it immediately sends you to a desktop, then check the layout switcher at top right, you'll see that the "traditional phonetic" layout has been added - even though you didn't ask for it, and you don't need it (all the Bulgarian layouts are capable of typing all the characters necessary for the locale, I believe).
Much the same happens if you run an install instead of going to the live desktop - when you boot after the install is complete, right from the first screen of g-i-s' first boot mode, you have an extra layout.