Arabic keyboard in OpenBSD: how to install / use?


#1

Hi! I had a quick question, hopefully painless one for you all. I’m running OpenBSD 6.3. I switch between a mix of desktop (dwm through startx) and terminal. I’m trying to figure out how to install and use an Arabic keyboard layout / encoding with BSD. Specifically, I want to be able to write in Arabic in emacs and in my web browser (for starters).

When I run kbd -l it doesn’t seem to me like any of those are Arabic keyboard layouts. But I’m not sure if that’s the right approach to be taking. Do I need to install a custom layout? Or is it a matter of finding the right fonts? Anyone have any idea about this, even in general terms about an approach I might take? Thanks!

It seems unlikely that OpenBSD would offer Arabic as one of its predefined keyboard layouts, but I’m wondering whether that means I’ll have to do my own custom mapping using unicode / UTF-8?


#2

@jggimi probably knows answer to your question. :slight_smile:


#3

I’ve figured out the answer to my own question :slight_smile:
I ended up using setxkbmap ara to change the keyboard. I can’t use Arabic in the console / tty, but in X I can. I ideally want to be able to switch between the two keyboards easily, and I do that by adding the following to my ~/.xinitrc file:

setxkbmap -layout us,ara -option grp:alt_space_toggle

So now when I’m in X, I can just press alt-space and it’ll switch the layout. There are some other options / key combinations possible in the -option option, but I’m not sure where those are written up.


#4

Nice :yum:
Don’t you have something similar to this in OpenBSD?

8.1.2.1.1. Hacking wscons to add a keymap

If your favourite keymap is not supported, you can start digging in src/sys/dev/wscons/wsksymdef.h and src/sys/dev/pckbport/wskbdmap_mfii.c to make your own. Be sure to send-pr a change-request PR with your work, so others can make use of it!

You can test your keymap by using wsconsctl instead of directly hacking the keymaps into the keyboard mapping file. For example, to say keycode 51 without any modifiers should map to a comma, with shift it should map to a question mark, with alt it should map to a semicolon and with both alt and shift it should map to colon, issue the following command:

wsconsctl -w “map += keycode 51=comma question semicolon colon”


#5

Yes I think we have that, but the setxkbmap worked well enough for now


#6

setxkbmap works for xorg
wscons is for the console, but… I understand… mapping every singel key would be a PITA!