{
    "mode": "man",
    "parameter": "setxkbmap",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/setxkbmap/1/json",
    "generated": "2026-10-09T14:58:14Z",
    "synopsis": "setxkbmap [ args ] [ layout [ variant [ option ...  ] ] ]",
    "sections": {
        "NAME": {
            "content": "setxkbmap - set the keyboard using the X Keyboard Extension\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "setxkbmap [ args ] [ layout [ variant [ option ...  ] ] ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The setxkbmap command maps the keyboard to use the layout determined by the options specified\non the command line.\n\nAn  XKB  keymap is constructed from a number of components which are compiled only as needed.\nThe source for all of the components can be found in /usr/share/X11/xkb.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-compat _",
                    "content": "Specifies the name of the compatibility map component used to  construct  a  keyboard\nlayout.\n"
                },
                {
                    "name": "-config _",
                    "content": "Specifies  the  name  of an XKB configuration file which describes the keyboard to be\nused.\n"
                },
                {
                    "name": "-device _",
                    "content": "Specifies the numeric device id of the input device to be updated with the  new  key‐\nboard layout. If not specified, the core keyboard device of the X server is updated.\n"
                },
                {
                    "name": "-display _",
                    "content": "Specifies the display to be updated with the new keyboard layout.\n"
                },
                {
                    "name": "-geometry _",
                    "content": "Specifies the name of the geometry component used to construct a keyboard layout.\n"
                },
                {
                    "name": "-help",
                    "content": ""
                },
                {
                    "name": "-I _",
                    "content": "Adds a directory to the list of directories to be used to search for specified layout\nor rules files.\n",
                    "flag": "-I"
                },
                {
                    "name": "-keycodes _",
                    "content": "Specifies the name of the keycodes component used to construct a keyboard layout.\n"
                },
                {
                    "name": "-keymap _",
                    "content": "Specifies the name of the keymap description used to construct a keyboard layout.\n"
                },
                {
                    "name": "-layout _",
                    "content": "Specifies  the  name of the layout used to determine the components which make up the\nkeyboard description. The -layout option may only be used once. Multiple layouts  can\nbe specified as a comma-separated list.\n"
                },
                {
                    "name": "-model _",
                    "content": "Specifies  the name of the keyboard model used to determine the components which make\nup the keyboard description.  Only one model may be specified on the command line.\n"
                },
                {
                    "name": "-option _",
                    "content": "Specifies the name of an option to determine the components which make  up  the  key‐\nboard  description;   multiple  options  may be specified, one per -option flag. Note\nthat setxkbmap adds options specified in the command line to the  options  that  were\nset  before  (as  saved in root window properties). If you want to replace all previ‐\nously specified options, use the -option flag with an empty argument first.\n"
                },
                {
                    "name": "-print",
                    "content": "comp (an XKB keymap compiler) and exits. The option can be used for tests instead  of\na  verbose  option and in cases when one needs to run both the setxkbmap and the xkb‐\ncomp in chain (see below).\n"
                },
                {
                    "name": "-query",
                    "content": "options, then exits.\n"
                },
                {
                    "name": "-rules _",
                    "content": "Specifies the name of the rules file used to resolve the requested layout  and  model\nto a set of component names.\n"
                },
                {
                    "name": "-symbols _",
                    "content": "Specifies the name of the symbols component used to construct a keyboard layout.\n"
                },
                {
                    "name": "-synch",
                    "content": ""
                },
                {
                    "name": "-types _",
                    "content": "Specifies the name of the types component used to construct a keyboard layout.\n"
                },
                {
                    "name": "-variant _",
                    "content": "Specifies which variant of the keyboard layout should be used to determine the compo‐\nnents  which  make  up the keyboard description. The -variant option may only be used\nonce. Multiple variants can be specified  as  a  comma-separated  list  and  will  be\nmatched with the layouts specified with -layout.\n"
                },
                {
                    "name": "-verbose|-v [_",
                    "content": "Specifies  level  of  verbosity in output messages.  Valid levels range from 0 (least\nverbose) to 10 (most verbose).  The default verbosity level is 5.   If  no  level  is\nspecified, each -v or -verbose flag raises the level by 1.\n"
                },
                {
                    "name": "-version",
                    "content": "Prints the program's version number.\n\nUSING WITH xkbcomp\nIf you have an Xserver and a client shell running on different computers and some XKB config‐\nuration files on those machines are different, you can get problems specifying a keyboard map\nby  model,  layout,  and  options names.  This is because setxkbmap converts its arguments to\nnames of XKB configuration files according to files that are  on  the  client-side  computer,\nthen  sends  these  file names to the server where xkbcomp has to compose a complete keyboard\nmap using files which the server has.  Thus if the sets of files  differ  in  some  way,  the\nnames  that  setxkbmap  generates can be unacceptable on the server side.  You can solve this\nproblem by running the xkbcomp on the client side too.  With the -print option setxkbmap just\nprints the file names in an appropriate format to its stdout and this output can be piped di‐\nrectly to the xkbcomp input.  For example, the command\n"
                },
                {
                    "name": "setxkbmap us -print | xkbcomp - $DISPLAY",
                    "content": "makes both steps run on the same (client) machine and loads a keyboard map into the server.\n\n"
                }
            ]
        },
        "XWAYLAND": {
            "content": "Xwayland is an X server that uses a Wayland Compositor as backend.  Xwayland acts as transla‐\ntion layer between the X protocol and the Wayland protocol but does not manage the keymaps  -\nthese are handled by the Wayland Compositor.\n\nChanging  the  keymap  with setxkbmap is not supported by Xwayland.  In most instances, using\nsetxkbmap on Xwayland is indicative of a bug in a shell script and  setxkbmap  will  print  a\nwarning. Use the Wayland Compositor's native XKB configuration methods instead.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "xkbcomp(1), xkeyboard-config(7)\n",
            "subsections": []
        },
        "FILES": {
            "content": "/usr/share/X11/xkb\n\nX Version 11                               setxkbmap 1.3.4                              SETXKBMAP(1)",
            "subsections": []
        }
    },
    "summary": "setxkbmap - set the keyboard using the X Keyboard Extension",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of the compatibility map component used to construct a keyboard layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of an XKB configuration file which describes the keyboard to be used."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the numeric device id of the input device to be updated with the new key‐ board layout. If not specified, the core keyboard device of the X server is updated."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the display to be updated with the new keyboard layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of the geometry component used to construct a keyboard layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-I",
            "long": null,
            "arg": null,
            "description": "Adds a directory to the list of directories to be used to search for specified layout or rules files."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of the keycodes component used to construct a keyboard layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of the keymap description used to construct a keyboard layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies 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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies 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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of an option to determine the components which make up the key‐ board 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 previ‐ ously specified options, use the -option flag with an empty argument first."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "comp (an XKB keymap compiler) and exits. 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 xkb‐ comp in chain (see below)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "options, then exits."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of the rules file used to resolve the requested layout and model to a set of component names."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of the symbols component used to construct a keyboard layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies the name of the types component used to construct a keyboard layout."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies which variant of the keyboard layout should be used to determine the compo‐ nents 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."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Specifies level of verbosity in output messages. Valid levels range from 0 (least verbose) to 10 (most verbose). The default verbosity level is 5. If no level is specified, each -v or -verbose flag raises the level by 1."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Prints the program's version number. USING WITH xkbcomp If you have an Xserver and a client shell running on different computers and some XKB config‐ uration 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 these 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 di‐ rectly to the xkbcomp input. For example, the command"
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "xkbcomp",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/xkbcomp/1/json"
        },
        {
            "name": "xkeyboard-config",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/xkeyboard-config/7/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Set the keyboard using the X Keyboard Extension.",
        "examples": [
            {
                "description": "Set the keyboard in French AZERTY",
                "command": "setxkbmap {{fr}}"
            },
            {
                "description": "Set multiple keyboard layouts, their variants and switching option",
                "command": "setxkbmap -layout {{us,de}} -variant {{,qwerty}} -option '{{grp:alt_caps_toggle}}'"
            },
            {
                "description": "List all layouts",
                "command": "localectl list-x11-keymap-layouts"
            },
            {
                "description": "List variants for the layout",
                "command": "localectl list-x11-keymap-variants {{de}}"
            },
            {
                "description": "List available switching options",
                "command": "localectl list-x11-keymap-options | grep grp:"
            },
            {
                "description": "Display help",
                "command": "setxkbmap -help"
            }
        ]
    }
}