xkbcommon provides multiple CLI
tools for debugging, grouped under the xkbcli application.
Please consult the manual pages man xkbcli for the complete documentation
of each tool.
@note These tools may not be installed by default; please ensure you have the
libxkbcommon-tools package installed.
- `xkbcli interactive`
-
Test your configuration interactively. It chooses the appropriate backend based
on the session type. Alternatively you may select explicitly the backend:
- `xkbcli interactive-wayland`
- Test in a *Wayland* session.
- `xkbcli interactive-x11`
- Test in an *X11* session.
- `xkbcli interactive-evdev`
- Test raw input events directly. This requires access to the `/dev/input/event*` devices, you may need to add your user to the `input` group or run as root.
Tip
You may want to use the flag
--enable-composeif your layouts use dead keys. - `xkbcli dump-keymap`
-
Dump an XKB keymap from a display server. It chooses the appropriate backend based
on the session type. Alternatively you may select explicitly the backend:
- `xkbcli dump-keymap-wayland`
- Dump an XKB keymap from a *Wayland* compositor.
- `xkbcli dump-keymap-x11`
- Dump an XKB keymap from an *X11* server.
- `xkbcli how-to-type`
- Find the required key combinations to produce a specific character or keysym.
- `xkbcli list`
- List available layouts, variants, and options provided by an XKB database.
- `xkbcli compile-keymap`
-
Compile a keymap and inspect its properties.
Tip
Use the options
--explicit-*to force the corresponding values to be explicit. This is especially useful to debug [compatibility interpretations]. - `xkbcli compile-compose`
- Compile [Compose](@ref compose) files.
- `xkbcli info`
- Print information about xkbcommon configuration.
[compatibility interpretations]: @ref interpret-statements
Each error has a unique identifier printed as [XKB-nnn] in the log.
See the [error index](@ref error-index) for the documentation of each error.
@note An erroneous XKB configuration may make your keyboard unusable. Therefore it is advised to try custom configurations safely with the following workflow:
-
Create a directory for the custom configuration, e.g.
~/xkb-test. Note that in order to test it safely, it should not be one of the locations that [xkbcommon searches][user-configuration locations]. -
Create the relevant sub-directories and files, e.g.
~/xkb-test/symbols/my-layout. -
Test if your changes compile successfully:
xkbcli compile-keymap --include ~/xkb-test --include-defaults --test --layout my-layout@note The order of the
--include*arguments is important here.If it does not compile, you may add the flag
--verbosefor additional information. -
Test if it behaves correctly. Note that you may need to add your user to the
inputgroup or run as root.xkbcli interactive-evdev --include ~/xkb-test --include-defaults --enable-compose --layout my-layout -
Repeat steps 3 and 4 with your full keyboard configuration, i.e. all your model, layouts and options.
-
If everything works as expected, it is time to test in real conditions:
-
Wayland: , move
~/xkb-testto one of the [user-configuration locations], restart your session, update the keyboard configuration using your usual UI and enjoy your XKB customization! -
X11: Unfortunately Xorg does not support alternative paths, so the next best option is to use the venerable
xkbcomptool.xkbcli compile-keymap --include ~/xkb-test --include-defaults --layout my-layout \ | xkbcomp - $DISPLAY
-
Happy hacking!
[user-configuration locations]: @ref xkb-data-locations