5.1 KiB
5.1 KiB
xkb resources
#
#
Introduction
Resources for using xkb to control keyboard map.
xmodmap is deprecated, because it requires a base to work from – it behaves like a 'patch'
Links
- http://madduck.net/docs/extending-xkb – xkb howto
- https://wiki.debian.org/XStrikeForce/InputHotplugGuide – debian hotplug guide for X11
Commands
setxkbmap
- model: keyboard model; defines which keys exist
- layout: keyboard layout; defines what keys do
- variant: layout variations
- options: configurable aspects – keyboard features
To install a new keymap:
setxkbmap -model thinkpad -layout us -variant intl -option grp:win_switch
To make capslock work like control:
setxkbmap -option ctrl:nocaps
Queries
xkb rules
cat //usr/share/X11/xkb/rules/evdev | grep grp:win
grp:win_switch = +group(win_switch) grp:win_space_toggle = +group(win_space_toggle) grp:win_menu_switch = +group(win_menu_switch)
find codes interactively
xev | sed -ne '/^KeyPress/,/^$/p'
Now press a key to get output like:
KeyPress event, serial 32, synthetic NO, window .. root .., subw .., time .., (878,1020), root:(2320,1621), state .., keycode 128 (keysym 0x1008ff4a, XF86LaunchA), same_screen YES
setxkbmap
Use setxkbmap to print what it would do without actually doing it:
setxkbmap -model thinkpad -layout us -variant intl -option grp:win_switch -print
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us(intl)+inet(evdev)+group(win_switch)" };
xkb_geometry { include "thinkpad(us)" };
};
/etc/default/keyboard
grep -i xkb /etc/default/keyboard
XKBMODEL="pc105" XKBLAYOUT="us" XKBVARIANT="" XKBOPTIONS=""
udevadm
udevadm info --export-db | grep -i XKB
E: XKBLAYOUT=us E: XKBMODEL=pc105 E: XKBLAYOUT=us E: XKBMODEL=pc105 E: XKBLAYOUT=us E: XKBMODEL=pc105 E: XKBLAYOUT=us E: XKBMODEL=pc105 E: XKBLAYOUT=us E: XKBMODEL=pc105
/var/log/Xorg.0.log
cat /var/log/Xorg.0.log | grep -C 1 -i 'internal keyboard'
[ 456.475] (II) This device may have been added with another device file. [ 456.475] (II) config/udev: Adding input device Apple Inc. Apple Internal Keyboard / Trackpad (/dev/input/event5) [ 456.475] (**) Apple Inc. Apple Internal Keyboard / Trackpad: Applying InputClass "evdev keyboard catchall" [ 456.475] (II) Using input driver 'evdev' for 'Apple Inc. Apple Internal Keyboard / Trackpad' [ 456.475] (**) Apple Inc. Apple Internal Keyboard / Trackpad: always reports core events [ 456.475] (**) evdev: Apple Inc. Apple Internal Keyboard / Trackpad: Device: "/dev/input/event5" [ 456.475] (--) evdev: Apple Inc. Apple Internal Keyboard / Trackpad: Vendor 0x5ac Product 0x262 [ 456.475] (--) evdev: Apple Inc. Apple Internal Keyboard / Trackpad: Found keys [ 456.475] (II) evdev: Apple Inc. Apple Internal Keyboard / Trackpad: Configuring as keyboard [ 456.475] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:14.0/usb1/1-12/1-12:1.0/0003:05AC:0262.0001/input/input5/event5" [ 456.475] (II) XINPUT: Adding extended input device "Apple Inc. Apple Internal Keyboard / Trackpad" (type: KEYBOARD, id 10) [ 456.475] (**) Option "xkb_rules" "evdev"
dump keyboard map
xkbcomp $DISPLAY /tmp/xkb.dump
cat /tmp/xkb.dump | head -18
xkb_keymap {
xkb_keycodes "evdev+aliases(qwerty)" {
minimum = 8;
maximum = 255;
<ESC> = 9;
<AE01> = 10;
<AE02> = 11;
<AE03> = 12;
<AE04> = 13;
<AE05> = 14;
<AE06> = 15;
<AE07> = 16;
<AE08> = 17;
<AE09> = 18;
<AE10> = 19;
<AE11> = 20;
<AE12> = 21;
<BKSP> = 22;