This is NOT a duplicate of Changing the keyboard layout/mapping on both the console (tty) and X in an X/console agnostic way?, where a system-wide /etc/default/keyboard
is discussed.
I'm looking to use a user-specific file, ~/.keyboard
, with xkb
settings that is used by both X (e.g., + LXDE), as well as by the (kernel) virtual consoles (VTs/TTYs).
As may be seen from cat $(which setupcon)
, virtual consoles can pick up a user-specific ~/.keyboard
file (or a VARIANT
thereof) if user's environment is preserved when setupcon
is run:
sudo -E setupcon
where setupcon
will (more or less) convert the xkb-based ~/.keyboard
settings (XKBMODEL
, XKBLAYOUT
, XKBOPTIONS
, etc.) into console keymap type (via ckbcomp
) and loadkeys
the result into consoles. If user's environment is NOT preserved,
sudo setupcon
then /etc/default/keyboard
is picked up.
However, as far I can see, in X setxkbmap
only picks up the system-wide /etc/default/keyboard
file. The user-specific ~/.keyboard
is not picked up by setxkbmap
. But that is what I need. In other words, I'm trying to feed ~/.keyboard
to setxkbmap
. I would like to be able to have this done both at X login (e.g., with a line in ~/.xsessionrc
), as well as to be able to make changes to ~/.keyboard
while in X and have them applied through setxkbmap
(without sudo
), much like setxkbmap -option
provides.
Note that I'm NOT trying to manually create a user-specific xkb directory hierarchy and use that with xkbcomp -I
. However, if there is an automated way of doing that with ~/.keyboard
as the input, that could be an acceptable workaround.
As of now, the only way I see is a hack: manually parse ~/.keyboard
, extracting XKBOPTIONS
and then write an equivalent setxkbmap -option
for each. I cannot believe for this hack to be the only way, although seeing https://who-t.blogspot.com/2020/02/user-specific-xkb-configuration-part-1.html makes me question that belief.
As of now I'm using Debian with X (+ LXDE). I don't think it makes a difference for Wayland, but if it does, please explain.
~/.keyboard
...", as opposed to have it automatically read bysetxkbmap
. I can do that myself, but it is hard to believe this feature is not there insetxkbmap
. – 0mid Dec 10 '20 at 21:17