Linux command
xev 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start xev
xev
Show only keyboard events
xev -event keyboard
Show only mouse button
xev -event button
Monitor specific window
xev -id [window_id]
Monitor root window
xev -root
说明
xev is an X11 event monitoring utility that displays all events received by a window. When launched, it opens a small window and prints detailed information about every X event that occurs within it, including key presses, mouse movements, button clicks, window exposure, and focus changes. The tool is primarily used for debugging X11 input issues and discovering keycodes for keyboard configuration. Each event is printed with full details including keycodes, key symbols, coordinates, modifier states, and timestamps. This makes it invaluable for setting up key bindings in window managers or diagnosing input problems. Events can be filtered by type using the -event option to show only keyboard, mouse, button, or motion events. The -id option monitors events on a specific existing window, while -root captures events on the root window for display-wide monitoring.
参数
- -display _DISPLAY_
- X server to contact.
- -event _TYPE_
- Event type filter (can be specified multiple times).
- -id _WINDOW_
- Monitor events on an existing window by ID.
- -root
- Monitor events on the root window.
- -name _NAME_
- Name to assign to the created window.
- -geometry _GEOM_
- Window size and position.
- -bw _PIXELS_
- Border width for the window.
- -bs _TYPE_
- Backing store type (NotUseful, WhenMapped, Always). Default NotUseful.
- -rv
- Display window in reverse video.
FAQ
What is the xev command used for?
xev is an X11 event monitoring utility that displays all events received by a window. When launched, it opens a small window and prints detailed information about every X event that occurs within it, including key presses, mouse movements, button clicks, window exposure, and focus changes. The tool is primarily used for debugging X11 input issues and discovering keycodes for keyboard configuration. Each event is printed with full details including keycodes, key symbols, coordinates, modifier states, and timestamps. This makes it invaluable for setting up key bindings in window managers or diagnosing input problems. Events can be filtered by type using the -event option to show only keyboard, mouse, button, or motion events. The -id option monitors events on a specific existing window, while -root captures events on the root window for display-wide monitoring.
How do I run a basic xev example?
Run `xev` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -display _DISPLAY_ do in xev?
X server to contact.