this post was submitted on 19 Jul 2023
6 points (100.0% liked)

OpenBSD

539 readers
1 users here now

General OpenBSD community!

founded 1 year ago
MODERATORS
 

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 ?

top 7 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 1 year ago (1 children)

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/

[–] [email protected] 2 points 1 year ago (1 children)

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.

[–] [email protected] 2 points 1 year ago

Nice - thanks for sharing

[–] [email protected] 1 points 1 year ago (1 children)

depending on what sort of keyboard you have, you could do it in the keyboard's firmware:

https://github.com/qmk/qmk_firmware

https://github.com/kmonad/kmonad

[–] [email protected] 1 points 1 year ago

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.

[–] [email protected] 1 points 1 year ago (1 children)

I have not done it and rely on setxkbmap since I mainly use X whenever I can. However according to the openbsd mailing list^1^ you should create /etc/wsconsctl.conf (see wsconsctl.conf(5)) and fill it with the correct values.

  1. https://marc.info/?l=openbsd-misc&m=162532956709646&w=2
[–] [email protected] 1 points 1 year ago

I'll try that, thanks !