xev
Display X server event details
TLDR
Monitor all occurring X events
Monitor all X events of the root window instead of creating a new one
Monitor all X events of a particular window
Monitor X events from a given category (can be specified multiple times)
SYNOPSIS
xev [-display displayname] [-geometry geometry] [-rv] [-bw borderwidth] [-bs backingstore] [-id windowid] [-name windowname] [-event eventmask] [-send-event] [-synchronous]
PARAMETERS
-display displayname
Specifies the X server to connect to. If not specified, it uses the value of the DISPLAY environment variable.
-geometry geometry
Sets the size and position of the xev window (e.g., -geometry 500x300+100+100).
-rv
Reverses foreground and background colors.
-bw borderwidth
Sets the width of the window border in pixels.
-bs backingstore
Specifies the backing store attribute for the window. Can be Always, WhenMapped, or NotUseful.
-id windowid
Specifies an existing window ID to monitor instead of creating a new window.
-name windowname
Sets the window name to windowname.
-event eventmask
Selects specific event types to monitor. Use with caution.
-send-event
Indicates that the generated events should be sent to the client.
-synchronous
Makes X requests synchronous.
DESCRIPTION
xev is a command-line tool in Linux (and other Unix-like systems) that allows you to display information about X Window System events. When executed, it creates a window and monitors all X events happening within that window, printing details to the standard output. This tool is invaluable for debugging X applications, understanding how user interactions translate into events, and identifying the specific properties associated with those events.
By observing the output from xev, developers can gain insights into keyboard presses, mouse movements, window manipulations, and other relevant events, helping them troubleshoot and optimize their applications for the X Window System. It is especially useful for verifying that events are being correctly generated and handled by GUI components.
The output can be quite verbose, so it's generally best to focus on specific events or event types when using xev for debugging purposes. Understanding the structure of X events is essential to efficiently leverage the information provided by xev.
UNDERSTANDING EVENT OUTPUT
The output of xev can be overwhelming.
Each event is described by its type (e.g., KeyPress, ButtonPress, MotionNotify) and includes various properties such as coordinates, key codes, button numbers, and modifiers. Understanding the meaning of these properties is crucial for interpreting the event stream effectively.
Using tools like xev for a small window or a specific event may greatly improve readability of the output.