On Wed, Nov 23, 2022 at 06:57:17AM +0000, Jason McIntyre wrote:
> On Wed, Nov 23, 2022 at 12:21:26AM +0100, Mike Fischer wrote:
> > Hi!
> > 
> > I???m trying to use a German Apple Mac keyboard with OpenBSD 7.2 and I???d 
> > like to match the mapping to that of macOS.
> > 
> > `wsconsctl keyboard.encoding=de` helps, but several mappings are 
> > different/missing. For example the pipe character | should be alt-7 but 
> > isn???t. Mostly the alt-combinations are missing or wrong.
> > 
> > So I thought I could use keyboard.map settings to correct this. But I 
> > can???t find any documentation of the format ??? very unusual for OpenBSD.
> > 
> > Did I miss something?
> > 
> > Can someone point me to the documentation please?
> > 
> > Thanks!
> > 
> > Mike
> > 
> 
> hi.
> 
> maybe you are looking for wsksymdef.h:
> 
>     WSCONSCTL(8)       System Manager's Manual         WSCONSCTL(8)
> 
>       ...
> 
>        Modify the current keyboard encoding so that, when the Caps
>        Lock key is pressed, the same encoding sequence as Left
>        Control is sent.  For a full list of keysyms, and keycodes,
>        refer to the /usr/include/dev/wscons/wsksymdef.h file.
> 
>              # wsconsctl keyboard.map+="keysym Caps_Lock =
>              Control_L"
> 
> jmc
> 

Hey,

If it helps, here's my wsconsctl.conf to add some Romanian keyboard
bindings in the console for keys which are behind AltGr. Note, I've
intentionally made some Romanian specific unicode characters output
a literal `?' since they're not very usable in wscons.

You can either use symbolic names (from wsksymdef.h) or use stuff like
`unknown_51355' to give it a U+code point in decimal form. For German,
you probably have everything you need in wsksymdef.h. Note, the format
is also very similar to xkb; originally I thought they were the same
(they aren't 100% the same).


    keyboard.encoding=us
    keyboard.map+="keysym Caps_Lock = Control_L"
    mouse.tp.tapping=3
    mouse.reverse_scrolling=1
    keyboard.map+="keysym Caps_Lock = Control_L"
    keyboard.map+="keycode 184 = Cmd2 Mode_switch Multi_key"
    # use ? for unicode that causes mojibake
    keyboard.map+="keycode 26 = question question bracketleft braceleft"
    keyboard.map+="keycode 27 = question question bracketright braceright"
    keyboard.map+="keycode 39 = question question semicolon colon"
    keyboard.map+="keycode 40 = question question apostrophe quotedbl"
    keyboard.map+="keycode 41 = question question grave asciitilde" # 3byte 
UTF-8, don't bother
    keyboard.map+="keycode 43 = question question backslash bar"
    keyboard.map+="keycode 51 = comma semicolon less question"
    keyboard.map+="keycode 52 = period colon greater question"

A more proper example for e.g. keycode 26:

    keyboard.map+="keycode 26 = abreve Abreve bracketleft braceleft"

Or for keys that don't have a symbolic name:

    keyboard.map+="keycode 43 = unknown_50082 unknown_50050 backslash bar"

I started from US which is 90% there, and the first thing is to add
right Alt as `Mode_switch', otherwise it's just (left) Alt (which I
think just sets the MSB, IDK; you want AltGr/Mode_switch if you want to
map specific characters).

Which keycode is what? I don't know. I dumped the hu layout as a
reference with `doas wsconsctl keyboard.map > hu.map' and looked at what
was done for that crazy layout, and started from there.

Cheers,
Vlad

Reply via email to