I've been able to change the keyboard layout/mapping when the X Window System is running using ~/.Xmodmap
(and I suppose you could also do it through the X protocol directly, eg. using libxcb as a wrapper around X protocol calls).
I've been able to do the same (somewhat) on the console/tty (ie. when X is not running) using loadkeys
.
Is there a way to customize the keyboard layout similarly, but from a single source, in such a way that it affects both X and the console, ie. in a way that is "X-and-console agnostic"?
(The only way I can think of is by writing a "keyboard driver" that talks to the kernel's input interface, evdev
, and sends the input you want (through uinput
?), or something, but I don't know if this even makes sense, or if there's an easier way.)
dpkg-reconfigure keyboard-configuration
, on Red Hat:localectl set-keymap
and similar. Is this what you need? Related1 and Related2 – Nov 04 '18 at 01:33