The problem
Pressing ALT + SHIFT once to switch from the us to ru layout seemingly changes nothing, and Latin characters are still being inputted. If I press ALT + SHIFT once again, however, cyrillic characters start being inputted. It’s as if there was another layout with Latin characters between the us and the ru ones. To switch back from ru to us, it is enough to press ALT + SHIFT just once. The problem is that it is very inconsistent.
Another thing to note is that even when switched to ru, the status bar (see attached screenshot) indicates “en”.
I read that GNOME overrides xkbOptions. Is the problem in dconf or GSettings?
I am very new to NixOS and know very little of Linux in general, so any help would be appreciated. To know what direction I should be digging in would be great.
As mentioned in the other thread, GNOME manages the keyboard layout and relevant settings itself and the services.xserver.{layout,xkb*} NixOS options are only used for initial set up.
Your issue sounds like you have another layout added in GNOME – try clicking the language panel in the top bar to see them.
Hmm, if there is just the two languages, maybe there is split brain between X server and GNOME. I would probably avoid grp:alt_shift_toggle and configure the layout switching shortcut directly in GNOME.
And, for completeness, dconf databases also recently became configurable in NixOS so you do not need home-manager if you do not have multi-user system or all users use the same layouts (untested):
services.xserver = {
layout = "us,ru";
};
programs = {
dconf = {
profiles = {
user = {
databases = [
{
# Disallow changing the input settings in Control Center since unlike with NixOS options,
# there is no merging between databases and user-db would just replace this.
lockAll = true;
settings = {
"org/gnome/desktop/wm/keybindings" = {
switch-input-source = [ "<Alt>Tab" ];
switch-input-source-backward = [ "<Shift><Alt>Tab" ];
};
"org/gnome/desktop/input-sources" = {
sources = [
(lib.gvariant.mkTuple [
"xkb"
"us"
])
(lib.gvariant.mkTuple [
"xkb"
"ru"
])
];
};
};
}
];
};
};
};
};