LinuxCommandLibrary

xkbcomp

Compile XKB keyboard descriptions

TLDR

Compile keymap for current display

$ xkbcomp [keymap.xkb] $DISPLAY
copy
Extract current keymap to file
$ xkbcomp $DISPLAY [output.xkb]
copy
Compile to binary keymap file
$ xkbcomp -xkm [keymap.xkb] -o [keymap.xkm]
copy
Generate C header from keymap
$ xkbcomp -C [keymap.xkb] -o [keymap.h]
copy
Compile with additional include path
$ xkbcomp -I[/usr/share/X11/xkb] [keymap.xkb] $DISPLAY
copy
Verbose compilation
$ xkbcomp -v 10 [keymap.xkb] $DISPLAY
copy

SYNOPSIS

xkbcomp [options] source [destination]

DESCRIPTION

xkbcomp compiles XKB (X Keyboard Extension) keyboard descriptions into binary format or uploads them directly to an X server. It's the core tool for customizing keyboard layouts beyond what setxkbmap provides.
The tool can extract the current keymap from a running X server, modify it, and upload changes. Output formats include XKB source (.xkb), compiled binary (.xkm), and C headers for embedding in applications.
XKB provides advanced keyboard features including multiple layouts, dead keys, compose sequences, modifier handling, and accessibility options that simpler tools like xmodmap cannot achieve.

PARAMETERS

-xkb

Output XKB source format.
-xkm
Output compiled binary format.
-C
Output C header file.
-I dir
Add directory to include search path.
-o file
Specify output file name.
-v level
Set verbosity level (0-10).
-w level
Set warning level.
-dflts
Compute defaults for missing components.

CAVEATS

Complex syntax requires understanding XKB architecture. Without $DISPLAY, only creates files without loading. Errors can leave keyboard in unusable state; keep backup layout accessible.

HISTORY

xkbcomp is part of the X Keyboard Extension (XKB), introduced in X11R6 to replace the limited keyboard handling of earlier X versions. XKB provides a comprehensive framework for keyboard configuration that supports internationalization and accessibility features.

SEE ALSO

setxkbmap(1), xkbevd(1), xmodmap(1), xev(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community