I would like to add a new keyboard layout (FR - AZERTY AFNOR). What is the correct way to do it ?
Ideally I would like to use it for everything:
- full disk encryption
- TTY
- xenodm
- xenocara session
For now, I updated /usr/X11R6/share/X11/xkb/symbols/fr
to add the variant, which I load in xenodm and my xsession using setxkbmap
.
However I feel like it’s not “clean” as it should be done with wsconsctl
.
So what is the correct way to do it ?
Doing it via wscons(4) requires recompiling the kernel I think. Have a look at wskbd(4) and https://cvsweb.openbsd.org/src/sys/dev/pckbc/
I eventually managed to do it with
/etc/wsconsctl.conf
. You can load a base layout (“fr” in my case), and remap keys as you want using their symbols. Here is an exerpt from what I’ve done:keyboard.encoding=fr keyboard.map+="keycode 1 = at numbersign dead_breve dead_invertedbreve" keyboard.map+="keycode 2 = agrave 1 section Agrave" keyboard.map+="keycode 3 = eacute 2 dead_acute Eacute" keyboard.map+="keycode 4 = egrave 3 dead_grave Egrave" […]
The hardest part is to figure which keycode correspond to which key on the keyboard, but it’s not too hard if you dump the base layout with
wsconsctl keyboard.map
before-hand.Nice - thanks for sharing
I have not done it and rely on setxkbmap since I mainly use X whenever I can. However according to the openbsd mailing list1 you should create
/etc/wsconsctl.conf
(see wsconsctl.conf(5)) and fill it with the correct values.I’ll try that, thanks !
depending on what sort of keyboard you have, you could do it in the keyboard’s firmware:
I already use QMK and even have a base layer to emulate this keymap indeed :) But I feel like I should be able to do it “correctly” on openbsd.
The machine in question is a notebook so I’d like to be able to use this layout on the integrated keyboard.