1

I'm on Ubuntu 22.04.1 (jammy) LTS. My ultimate goal is to have the following keyboard layout configuration:

  • U.S. international (with AltGr dead keys) and Russian keyboard layouts;
  • switching between them using Alt+Shift (toggle) and Caps Lock (temporarily);
  • Having left Logo key as the compose key.

The behaviour I'm getting is that I seem to have two U.S. layouts, and one of them ignores AltGr in console.


My /etc/default/keyboard:

BACKSPACE="guess"
XKBLAYOUT="us,ru"
XKBMODEL="pc105"
XKBOPTIONS="compose:lwin,grp:caps_switch,grp:lalt_lshift_toggle,nbsp:level3n,terminate:ctrl_alt
_bksp"
XKBVARIANT="altgr-intl,"

The output of setxkbmap -print -verbose 10:

Setting verbose level to 10
locale is C
Trying to load rules file ./rules/evdev...
Trying to load rules file /usr/share/X11/xkb/rules/evdev...
Success.
Applied rules from evdev:
rules:      evdev
model:      pc105
layout:     us
Trying to build keymap using the following components:
keycodes:   evdev+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(evdev)
geometry:   pc(pc105)
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)"     };
        xkb_geometry  { include "pc(pc105)"     };
};

The output of gsettings list-recursively 'org.gnome.desktop.input-sources':

org.gnome.desktop.input-sources current uint32 0
org.gnome.desktop.input-sources mru-sources [('xkb', 'us+altgr-intl'), ('xkb', 'ru')]
org.gnome.desktop.input-sources per-window false
org.gnome.desktop.input-sources show-all-sources false
org.gnome.desktop.input-sources sources [('xkb', 'us+altgr-intl'), ('xkb', 'ru')]
org.gnome.desktop.input-sources xkb-options ['terminate:ctrl_alt_bksp', 'nbsp:level3n', 'grp:lalt_lshift_toggle', 'grp:caps_switch', 'lv3:ralt_switch', 'compose:lwin']

I've tried both sudo dpkg-reconfigure console-setup and sudo dpkg-reconfigure keyboard-configuration, rebooting and all. No effect.

Is there anything I'm forgetting?

Ainar-G
  • 171

2 Answers2

0

I'm not entirely sure, which thing fixed it, but I did the following:

  1. Removed ~/.xinputrc.

  2. Used im-config to set input method selection to default.

  3. Did what this comment recommends: Ubuntu 17.10 and later: can't change the input switching shortcut to alt+shift.

This seems to have fixed the switching issue, although I cannot access my English layout's third level by pressing Caps Lock and AltGr simultaneously. But I guess, that will be another question, heh.

Ainar-G
  • 171
0

I had this problem after installing debian-live-12.5.0-amd64-standard (Bookworm). The solution that I found was to run the following commands under root :

cd /etc/console-setup/
mv ./cached_UTF_8_del.kmap.gz ./cached_UTF_8_del.kmap.gz.backup
setupcon 

This working answer was explained here:

Re: Editing /etc/default/keyboard has no effect

Tue Nov 10, 2015 12:38 pm Yes, sure...

The script setupcon is responsible for setting up font and keyboard layout for console. For keyboard layout, it reads the file /etc/default/keyboard and generates an output file, /etc/console-setup/cached_UTF_8_del.kmap.gz in my case, other names are possible.

setupcon does not always generate this output file, it first checks if /etc/default/keyboard is NEWER than cached_UTF_8_del.kmap.gz

My RetroPie image was released in summer 2015, the timestamp of cached_UTF_8_del.kmap.gz[ was 26.3.2015 for this release. Problem was, i tried to change the layout on a "virgin" Retropie, no internet connection yet. The HW-clock was set to some date in 2014 as default value.

Thus, you can change /etc/default/keyboard as often as you want, it will always be recogniozed as older than cached_UTF_8_del.kmap.gz due to the wrong HW-clock, thus, cached_UTF_8_del.kmap.gz is never be refreshed.

Quick solution: delete your cached_UTF_8_del.kmap.gz, forcing setupcon to generate it again. Or, set your date using

Code: Select all

date -s

I never used a vanilla Raspbian image, however, I'm wondering why I didn't find something related to this issue after hours of googling. Can't believe I'm the first one encountering this issue...

thanks lugge !