IT lexicon › Programming › Modifiers (X11)

Modifiers (X11)

Programming På svenska → Updated: 2026-10-11

X11's eight modifier bits — Shift, Lock, Control and Mod1 through Mod5 — and the table that decides which keys set them.

The 1987 core protocol has no idea what Alt or the Windows key is. Every input event carries an eight-bit state instead, and the server keeps a modifier map saying which keycodes light which bit. Three have meaningful names. The rest are Mod1 to Mod5, and what they mean is convention: Mod1 is almost always Alt, Mod4 is Super, Mod2 is usually NumLock, while Mod3 and Mod5 vary between systems. A program that needs to be sure has to look up which bit carries the Num_Lock keysym. xmodmap -pm prints the table.

The classic consequence is shortcuts that stop working when NumLock is on. A passive grab on Mod4+Return matches exactly, and with NumLock lit the state is Mod4+Mod2. Window managers therefore register every binding four times: with and without Lock, with and without NumLock.

← Back to the lexicon