I'd like to swap some keys but only in external keyboard. Is this possible with xmodmap?

I've found this question: Can I Xmodmap only a specific device? but it refers only to mouse.

I found here http://wiki.linuxquestions.org/wiki/Configuring_keyboards

that "The Xmodmap/Setxkbmap Method ... changes how X handles the keycodes it receives" so one could think that it's not possible, but I can call:

setxkbmap -device <device_id>  -variant dvorak

and I obtain (partially) my desired result. So I have dvorak layout on external and "basic"=qwerty on my laptop keyboard. And I'd like to have my custom layout on external keyboard.

  • 1
    I'm pretty sure the answer is no. I went through this a while ago, and I ended up using xorg rules. In short, create a new keymap using xkb, not xmodmap (I suspect the latter is deprecated anyway), then create a new rule in /etc/X11/xorg.conf.d, with MatchProduct "FOO". – Sparhawk Feb 1 '16 at 22:52
  • Thanks Sparhawk, please look at edit. If I won't succeed I'll try your way. – sZpak Feb 1 '16 at 23:11
  • Oh okay, good find! I probably went the "newer" way because I was also running at-home-modifier on a specific keyboard, but your way looks like it should work. – Sparhawk Feb 1 '16 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.