Brian Sammon <debian-users-l...@brisammon.fastmail.fm> wrote: > On Mon, 05 Feb 2024 21:06:30 +0100 > hw <h...@adminart.net> wrote: > > > Yes, it's a misunderstanding: How can we change the keyboard > > layout? > > I recently dug into this because I am running Debian on a Chromebook, > and I wanted to map the Google-key (located next to the A key, where > you usually expect Caps-Lock to be) to be a Ctrl, for > Emacs-Correctness. I wanted a solution that would also work when I > used an external keyboard (which has an actual CapsLock next to the > A), and would work both in X and in console mode. > > The solution I found, which should work when using Wayland as well, > was to customize the lowlevel scancode-to-keycode mapping that is > managed by udev. You can have different remappings for different > keyboard models. > > This keymapping system is very powerful, but somewhat ideosyncratic, > and somewhat poorly documented. And it's an edit-the-configfile > system; I'm not aware of any GUI config tools for it. > > It took me over 2 hours to figure out and set up, after which I had a > scrambled pile of notes (in a text file) but not the energy to clean > them up. The next time I do it I expect it'll take me about an hour > (if the same process still applies) instead of the 15 minutes it > would take if I did a proper job of documenting it for myself. > > Some of the webpages in my notes that I remember being useful are: > https://wiki.archlinux.org/title/Keyboard_input > https://yulistic.gitlab.io/2017/12/linux-keymapping-with-udev-hwdb/ > (including some of the comments that contain more recent info) > https://medium.com/@canadaduane/key-remapping-in-linux-2021-edition-47320999d2aa
Many, many thanks for this post Brian. Those links are truly excellent. > Some somewhat-informative files on my computer were > /lib/udev/hwdb.d/60-keyboard.hwdb (comes with udev) > /usr/include/linux/input-event-codes.h (comes with linux-libc-dev > package) > > Gotchas include: > Some things *must* be in lowercase (keycodes, I think?) > Some things *must* be in uppercase (certain hexadecimal stuff?) > For best results, triple-check that the case you use is exactly the > same as the example/sample config files. If you get this wrong, udev > will just ignore the erroneous parts of your config file, (and you > might think it just didn't see it) instead of giving an error message. >