You are not logged in.

#1 2013-04-23 20:47:02

Registered: 2013-04-23
Posts: 1

Openbox: setxkbmap in .xinitrc seems not to work


I'm running Openbox on a laptop, and I also have a USB keyboard. I'm trying to set up the keyboard layout (for both keyboards) to switch between dvorak, querty, and Spanish dvorak. The following line is in ~/.xinitrc:

setxkbmap -layout "us,us,es" -variant "dvorak,,dvorak" -option "grp:caps_toggle"

I also have a file called "20-keyboard-layout.conf" in /etc/X11/xorg.conf.d:

Section "InputClass"
    Identifier              "keyboard-layout"
    MatchIsKeyboard         "on"
    Option "XkbLayout"      "us, us, es"
    Option "XkbVariant"     "dvorak, , dvorak"
    Option "XkbOptions"     "grp:caps_toggle"

This setup doesn't work as expected. If the USB keyboard is plugged in before I run startx, then both the laptop and USB keyboards seem to use dvorak (which is the layout specified in /etc/vconsole.conf), but they don't switch when I press capslock. If I then pull out the USB and put it back in, then the USB keyboard is able to switch layouts as expected, but the laptop keyboard is still stuck on dvorak. If, on the other hand, I manually run the aforementioned setxkbmap command from within Openbox, then both keyboards are able to switch between the layouts.

None of this behavior changes if the setxkbmap line is removed from ~/.xinitrc. I feel like that line is being completely ignored, which is frustrating, because it makes no sense.

I've tried Googling around and reading some of the man page for xorg.conf and various other things, to no avail. I'm relatively new to Linux--I've been using Arch for less than six months. Thanks for your help!


#2 2017-09-07 08:56:42

Registered: 2016-06-21
Posts: 6

Re: Openbox: setxkbmap in .xinitrc seems not to work


I am using Arch with Budgie-desktop and I have been experiencing this issue for maybe a couple of months now. It used to work just fine but at some point it changed. I finally decided to try to fix it so I don't have to run setxkbmap every time I log in, but I can't find the source of the problem. I have exactly the same behaviour, it is like the line on the xinitrc is simply being ignored. I suspect something is overriding the setting after X starts. How can find more about this?


#3 2017-09-07 09:03:49

From: .nz
Registered: 2009-05-09
Posts: 23,015

Re: Openbox: setxkbmap in .xinitrc seems not to work

Not necrobumping a five year old thread would be a good start: … bumping.22


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438


Board footer

Powered by FluxBB