← 返回命令列表

Linux command

setxkbmap 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

setxkbmap fr

Example

setxkbmap -layout us,de -variant ,qwerty -option 'grp:alt_caps_toggle'

Query

setxkbmap -query

Example

setxkbmap -model pc105 -layout us

Print

setxkbmap -layout us -print

Example

setxkbmap -device [device_id] -layout [layout]

说明

setxkbmap configures keyboard layouts for the X Window System using the X Keyboard Extension (XKB). It builds keymaps from components stored in /usr/share/X11/xkb and applies them to the current X session. The command supports multiple keyboard layouts that can be switched using configurable key combinations (options). Common switching options include grp:alt_shift_toggle, grp:caps_toggle, and grp:win_space_toggle.

参数

-layout _name_
Specifies layout name (comma-separated for multiple layouts)
-variant _name_
Specifies layout variant (comma-separated, matching layout order)
-model _name_
Specifies keyboard model (e.g., pc104, pc105, thinkpad)
-option _name_
Specifies XKB option (can be used multiple times)
-device _device_
Numeric device ID to update (default: core keyboard)
-display _display_
X display to update
-config _file_
XKB configuration file describing keyboard
-rules _file_
Rules file for resolving layout to components
-query
Display current rules, model, layout, variant, and options
-print
Output component names in xkbcomp format, then exit
-I _directory_
Add directory to search path for layout files
-v, -verbose _level_
Set verbosity level (0-10, default 5)
-help
Display usage information
-version
Print program version

FAQ

What is the setxkbmap command used for?

setxkbmap configures keyboard layouts for the X Window System using the X Keyboard Extension (XKB). It builds keymaps from components stored in /usr/share/X11/xkb and applies them to the current X session. The command supports multiple keyboard layouts that can be switched using configurable key combinations (options). Common switching options include grp:alt_shift_toggle, grp:caps_toggle, and grp:win_space_toggle.

How do I run a basic setxkbmap example?

Run `setxkbmap fr` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -layout _name_ do in setxkbmap?

Specifies layout name (comma-separated for multiple layouts)