Issues with locale and keyboard layouts

I’ve installed a couple weaks ago Endeavour OS and I’m having a weird issue: I cannot switch my keyboard layout using combination that I set using localectl. I’m running GDM and Budgie and here are some of outputs that can be useful:

>gsettings get org.gnome.desktop.input-sources sources
[('xkb', 'us'), ('xkb', 'ru')]

>localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: ru
      X11 Layout: ru,us
       X11 Model: dell
     X11 Variant: qwerty
     X11 Options: grp:alt_shift_toggle

>cat /etc/vconsole.conf
KEYMAP=ru

>cat /etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "ru,us"
        Option "XkbModel" "dell"
        Option "XkbVariant" "qwerty"
        Option "XkbOptions" "grp:alt_shift_toggle"
EndSection
>cat /etc/X11/xorg.conf.d/20-keyboard.conf
... same stuff ...

>gsettings get org.gnome.desktop.wm.keybindings switch-input-source
['<Alt>Shift_L', '<Super>space', 'XF86Keyboard']

>cat /etc/locale.gen | grep -v \#
en_US.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
en_US UTF-8

>cat /etc/locale.conf
LANG=en_US.UTF-8

Additionaly, when I’m logging in after boot, it appears that my greeter uses this file (and ignores every file listed above):

>cat /etc/default/keyboard 
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="ru,us"
XKBVARIANT="qwerty"
XKBOPTIONS="grp:alt_shift_toggle"

BACKSPACE="guess"

So the situation I have is:

  1. Greeter ignores localectl settings
  2. Budgie uses it’s own keybinding and ignores localectl settings
>cat /etc/locale.conf
LANG=en_US.UTF-8

this looks a bit short to me…
usually, it holds more:

LANG=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8

also:

>cat /etc/locale.gen | grep -v \#
en_US.UTF-8 UTF-8
en_GB.UTF-8 UTF-8
en_US UTF-8

is looking strange as there should not be en_US UTF-8 only en_US ISO-8859-1

Both are normal behavior. You just have to find your way.
OTOH, just FYI, with DEs,

  • when Xorg runs as root, its locale setting is always passed to user session, and IIRC, overrides other user keybindings. I think that Arch has changed Xorg to run as user, or at least it is possible. GDM always runs as user, so Xorg does as well. I know LightDM uses /etc/default/, so it’s possible GDM does too. It’s how the DM devs decide to do it, not the distro.
  • Keybindings are a thing of the DE, if it is designed so. Exception in previous paragraph.

Thanks for the replies.

>cat /etc/locale.conf
LANG=en_US.UTF-8

this looks a bit short to me…
usually, it holds more

As far as I understand, all of the mentioned variables are defaulting to what LANG is set to, so that shouldn’t be a problem.

petsam, thanks for a detailed post. There is a remaining issue: even if I configure DE and greeter with respected config files, they both ignore ALT+SHIFT combination set in the locale, even thought in DE it’s set to be used:

>gsettings get org.gnome.desktop.wm.keybindings switch-input-source
['<Alt>Shift_L', '<Super>space', 'XF86Keyboard']

It’s my limited knowledge I share. Don’t know everything. Still self educating :wink:

This is something Gnome/GDM devs know well. We are just learning by mistakes.

Here’s more:

  • Delete /etc/default/keyboard, unless it is owned (pacman -Qo /etc/default/keyboard) by some package (which I doubt. It’s usually written by Calamares installer default modules, to adhere to Ubu/Deb standards). Arch does not use it, but some individual packages check its existence and values).
  • Use same keyboard model to all configurations:
  • In case the above don’t fix it (check after modifications, reboot/re-login, if needed), specify us as first layout (don’t ask why, please… :slightly_smiling_face: )
  • Check with xev (install it if it’s not installed). Here is an example:
xev -event keyboard | grep -oE "\(keysym .*\)|keycode [0-9]* "

Press Left_Alt+Left_Shift twice, then move mouse pointer to the running terminal and Ctrl+C (to break command). My result:

keycode 36 
(keysym 0xff0d, Return)
keycode 64 
(keysym 0xffe9, Alt_L)
keycode 50 
(keysym 0xfe08, ISO_Next_Group)
keycode 64 
(keysym 0xffe9, Alt_L)
keycode 50 
(keysym 0xffe1, Shift_L)
keycode 64 
(keysym 0xffe9, Alt_L)
keycode 50 
(keysym 0xfe08, ISO_Next_Group)
keycode 64 
(keysym 0xffe9, Alt_L)
keycode 50 
(keysym 0xffe1, Shift_L)
^C

ISO_Next_Group seems to indicate layout toggle.


It’s fun how we learn things… :rofl:

I executed

xev -event keyboard | grep -oE "\(keysym .*\)|keycode [0-9]* "

After this I pressed twice Alt+Shift and twice Shift+Alt
I didn’t get ISO_Next_Group:

keycode 64 
(keysym 0xffe9, Alt_L)
keycode 64 
(keysym 0xffe9, Alt_L)
keycode 64 
(keysym 0xffe9, Alt_L)
keycode 64 
(keysym 0xffe9, Alt_L)
keycode 50 
(keysym 0xffe1, Shift_L)
keycode 50 
(keysym 0xffe1, Shift_L)
keycode 50 
(keysym 0xffe1, Shift_L)
keycode 50 
(keysym 0xffe1, Shift_L)

It seems like it’s no catch Alt+Shift when they pressed simultaneously

Please, start a new topic, posting info about your system, since not every system HW/SW is the same. :person_shrugging: