IT lexicon › Infra & Ops › Grab (X11)

Grab (X11)

Infra & Ops På svenska → Updated: 2026-10-07

An X client claiming all pointer or keyboard input for itself, regardless of which window has focus.

The X protocol distinguishes active and passive grabs. An active grab (XGrabPointer, XGrabKeyboard) takes effect immediately: an open menu grabs the pointer so that a click outside it goes to the menu, which closes. A passive grab (XGrabKey, XGrabButton) lies in wait for a particular key or button — which is how window managers catch global shortcuts. XGrabServer goes furthest and freezes every other client.

The model assumes clients trust each other. A program that grabs the keyboard and then hangs locks up the whole desktop, and screen lockers like XScreenSaver can't lock if someone else already holds a grab. That any client could listen in on the keyboard was one of the concrete reasons Wayland was built.

← Back to the lexicon