Adding Another Keyboard Input Language Through The Command-Line on Gnu/Linux Debian

Instructions on adding additional input languages directly through the terminal. This edits the keyboard settings file for the X Window System. Steps tested on Debian 10 Buster, running AwesomeWM. Includes an example on adding a cyrillic keyboard layout.

Note: These settings likely won’t work if there is no X Window System installed.

Solution

  1. Edit with sudo: /etc/default/keyboard
  2. Append to file:
    XKBMODEL="pc105"
    XKBLAYOUT="us,de,fr,ua,ru"
    XKBVARIANT=""
    XKBOPTIONS="grp:alt_shift_toggle"
  3. Save, exit, reboot.

Example With Cyrillic Keyboard Layout

XKBMODEL="pc105"
XKBLAYOUT="us,bg"
XKBVARIANT="mac,phonetic"
XKBOPTIONS="grp:alt_shift_toggle"

Note on AwesomeWM

On a minimal graphical install of Debian, AwesomeWM (using default config) works with the XKB options set in /etc/default/keyboard. No need to tinker with the AwesomeWM config.

Other Notes

  1. To refresh keyboard settings, either reboot the system or use: sudo udevadm trigger --subsystem-match=input --action=change
  2. There is a known bug when switching through triple layouts. Switching occurs: Layout1 -> Layout2 -> Layout1 -> Layout3
  3. All available keyboard models, layouts, variants and options are in /usr/share/X11/xkb/rules/xorg.lst

References

  1. Keyboard – Debian Wiki
  2. man keyboard

Did this solve your issue?