Linux: xkb Tutorial

By Xah Lee. Date: . Last updated: .

2015-07-15 this page is work in progress. Ignore it.

xkb X Keyboard Extension

xkb (X Keyboard Extension) is a more capable system to set keys in X11, than xmodmap. [see Linux: xmodmap Tutorial]

setxkbmap → set the keyboard using the X Keyboard Extension.

# set layout to us
setxkbmap -layout us
# set layout to US dvorak
setxkbmap -layout us -variant dvorak
# setxkbmap example, set to US, Dvorak, and swap Ctrl Caps
setxkbmap -layout us -variant dvorak -option ctrl:swapcaps
# reset all custom keymap to default
setxkbmap -option

How to find xkb key notation?

look at:

setxkbmap ctrl:nocaps

man setxkbmap man xkeyboard-config

#clear xkb cache
sudo rm -rf /var/lib/xkb/

xkb resource

[comprehensive guide to XKB for linux By Damiano Venturin. At https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450 ]

2024-03-16 https://codeberg.org/ieure/xkbsucks

[XKB tutorial By Doug Palmer. At http://www.charvolant.org/~doug/xkb/html/node5.html , accessed on 2017-01-09 ]

[A simple, humble but comprehensive guide to XKB for linux By Damiano Venturin. At https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450 , accessed on 2016-06-17 ]

https://wiki.archlinux.org/index.php/X_KeyBoard_extension