Table of contents
setxkbmap - set keyboard and layouts via the X Keyboard Extension
setxkbmap
[ options ] [ layout [ variant [ option ... ] ] ]
The setxkbmap utility maps the keyboard to use the specified layout in an X session.
The options are as follows:
- -?, -help
- Print a message describing the valid input to setxkbmap.
- -compat name
- Specify the name of the compatibility map component used to construct a keyboard layout.
- -config file
- Specify the name of an XKB configuration file which describes the keyboard to be used.
- -device device
- Specify the numeric device id of the input device to be updated with the new keyboard layout. If not specified,
the core keyboard device of the X server is updated.
- -display display
- Specify the display to be updated with the new keyboard layout.
- -geometry name
- Specify the name of the geometry component used to construct a keyboard layout.
- -I directory
- Add a directory to the list of directories to be used to search for the specified layout or rules files.
- -keycodes name
- Specify the name of the keycodes component used to construct a keyboard layout.
- -keymap name
- Specify the name of the keymap description used to construct a keyboard layout.
- -layout name
- Specify the name of the layout used to determine the
components which make up the keyboard description. The -layout option may only be used once.
Multiple layouts can be specified as a comma-separated list.
- -model name
- Specify the name of the keyboard model used to determine the components which make up the keyboard description.
Only one model may be specified on the command line.
- -option name
- Specify the name of an option to determine the components which make up the keyboard
description; multiple options may be specified, one per -option flag. Note
that setxkbmap adds options specified in the command line to the options
that were set before (as saved in root window properties). If you want
to replace all previously specified options, use the -option flag with an
empty argument first.
- -print
- Print component names in a format acceptable by the xkbcomp keymap compiler and exit.
The option can be used for tests instead of a verbose option and in cases
when one needs to run both the setxkbmap and the xkbcomp in chain (see below).
- -query
- Print the current rules, model, layout, variant, and options, then exit.
- -rules file
- Specify the name of the rules file used to resolve the requested layout and model to
a set of component names.
- -symbols name
- Specify the name of the symbols component used to construct a keyboard layout.
- -synch
- Force synchronization for X requests.
- -types name
- Specify the name of the types component used to construct a keyboard layout.
- -variant name
- Specify which variant of the keyboard layout should be used to determine the components which make
up the keyboard description. The -variant option may only be used once.
Multiple variants can be specified as a comma-separated list and will be matched with the layouts specified with -layout.
- -v[erbose] [level]
- Specify level of verbosity in output messages.
Valid levels range from 0 (least verbose) to 10 (most verbose). Default: 5.
If no level is specified, each -v or -verbose flag raises the level by 1.
- -version
- Print the utility's version number and exit.
If you have an Xserver and a client shell running on different computers and some XKB configuration files on those
machines are different, you can get problems specifying a keyboard map by
model, layout and options names. This is because setxkbmap converts its arguments
to names of XKB configuration files according to files that are on
the client-side computer, then sends the file names to the server where
xkbcomp has to compose a complete keyboard map using files which the
server has. Thus if the sets of files differ in some way, the names that
setxkbmap generates can be unacceptable on the server-side. You can
solve this problem by running the xkbcomp on the client-side too. With the
-print option setxkbmap just prints the file names in an appropriate format
to its stdout and this output can be piped directly to the xkbcomp input.
For example, the command
setxkbmap us -print | xkbcomp - $DISPLAY (on Linux/Unix) or
setxkbmap us -print | xkbcomp -Rxkb - %DISPLAY% (on Windows)
makes both steps run on the same (client) machine and loads a keyboard map into the server.
The source for all of the components can be found in directory xkb.
xkbcomp
Table of contents

The
Xming website, documentation and images are licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
Copyright © 2005-2026 Colin Harrison All Rights Reserved