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" EndSection
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!