Setting my keyboard in X


#1

I’ve been trying to figure this out for hours now with the man pages but can’t quite make it work so I thought I’d see if someone has experience of this here.

I use a Colemak keyboard layout. This is not one of the inbuilt keyboard layout options offered by OpenBSD so Colemak offers a very crude script that sets all the keys here. I’ve adapted this and used it in my /etc/ files to load the script on startup. This way, Colemak keyboard is working more or less immediately in the console.

When I start up X (with startx command), however, the keyboard mapping isn’t brought into X. I type into the xterm and it’s QWERTY again.

I’ve been looking how to set this for hours now, as I said. From what I’ve been reading, it seems that X has different settings to the console and that I need to specify any keyboard options specifically for X. It seems that an xorg.conf file would be the place to do that.

There’s also the setxkbmap command which seems also what I need. I try running the command from the console, though, and it says that the command isn’t found. I’m not quite sure what to do since it is mentioned in the manual pages, but how to get it to work??

In any case, I assume this is an issue that lots of people have had in the past. I just can’t seem to get past things. Happy to do more RTFM, but which parts to read? I feel like I’m probably missing something really obvious.

Can someone help me out? Thank you!


#2

UPDATE: This was sent to me. It pointed towards the setxkbmap command which I ran as follows:

setxkbmap -layout us\(colemak\)

That changed the layout in X from within xterm. (Yay!)

Now I just need to figure out how I can specify that in some sort of setup / initialisation file for X, I guess, so that it loads every time…


#3

Put it in your .xinitrc

EDIT: These are the two last lines in my .xinitrc on NetBSD

xrdb -merge ~/.Xresources && setxkbmap se
exec awesome

Change se to what it’s working for you and replace awesome with whatever wm or de you are using.


#4

Perfect that works! Is that an unusual syntax? In the manpages it says setxkbmap should be used with -layout. Do you know why that gets removed when its in the .xinitrc file?


#5

Sorry, no idea… I’m a Void linux user to start with :wink:
So, take it as it is… it works right? Again, linux user… :smiley:


#6

Haha yeah just trying to understand. Thank you!


#7

Ok, I must say… I’ve never thought about it!.. I had the same issue as you had now when I built my Void system :roll_eyes:
I didn’t look into the man pages :blush: Yeah, I know… linux user :zipper_mouth_face:
I just tried until it worked, than I didn’t thought about it anymore. Was not even aware of the -layout option :sunglasses:

EDIT: By the way, glad it worked for you also :hugs:


#8

Did you switch from Void now? Why were you using Void before? What did you like about it? and why did you switch to NetBSD?


#9

Oh man…
I’m still using Void and I love it! It offers a base system, in a way kind of more basic than NetBSD. On Void you have to install Xorg, it’s not there to start with. Actually, you can even install xorg-minimal and add only the drives you need for your hardware. Yeah, I know I can compile a custom kernel on NetBSD as well.

Also, Void has builds for musl-libC (that’s what I have installed), not only GlibC.
Void was originally developed by a NetBSD dev, so in a sense they are related. The package manager xbps is similar to pkgin, but you also have xbps-src which is similar to pkgsrc.
I could go on forever… but, Void is the closest you can get to BSD on linux. They even ported doas as a replacement for sudo :smile:


#10

Cool sounds interesting! Very minimal… I’m using dwm and some of the suckless tools with openbsd and enjoying it very much.


#11
  1. I’m scared of the increasing influence microsoft has in the Linux foundation.
  2. I was a UNIX user in the early days, even though, I never thought about it.

Cool, awesome is derived from dwm :yum: Budies?


#12

Just for the sake of completeness…
https://www.x.org/archive/X11R7.7/doc/man/man1/setxkbmap.1.xhtml
Also, I’ve found this list


#13

Yes thanks. I looked at both of those, helpfully in the OpenBSD manpages. Though unfortunately doesn’t seem to answer why the options flag is absent in the .xinitrc file :slight_smile:


#14

According to the Gentoo wiki, https://wiki.gentoo.org/wiki/Keyboard_layout_switching

Setting a keyboard layout:
user $setxkbmap lv

Probably, where I took it from :roll_eyes:
It seams that the -layout option is only used If you need to alternate between a number of different keyboard layouts.