LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

xev

X11 event monitoring tool

TLDR

Start xev
$ xev
copy
Show only keyboard events
$ xev -event keyboard
copy
Show only mouse button events
$ xev -event button
copy
Monitor specific window by ID
$ xev -id [window_id]
copy
Monitor root window events
$ xev -root
copy

SYNOPSIS

xev [-event type] [-id window] [-root] [options]

DESCRIPTION

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.

PARAMETERS

-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.

EVENT TYPES

keyboard - Key press/release eventsmouse - All pointer eventsbutton - Button press/release eventsmotion - Pointer motion eventsexpose - Expose eventsvisibility - Visibility change eventsstructure - Window structure eventssubstructure - Substructure eventsfocus - Focus change eventsproperty - Property change eventscolormap - Colormap eventsowner_grab_button - Owner grab button eventsrandr - RandR events

CAVEATS

X11 only, not Wayland. Creates visible window. Output is verbose.

HISTORY

xev is part of the standard X11 utilities. It's essential for understanding X input events and configuring key bindings.

SEE ALSO

xdotool(1), xmodmap(1), xinput(1)

Copied to clipboard
Kai