modcheck is a minimalist X11 utility that checks the current state of keyboard modifier keys. It queries the X server to determine which modifier keys (Super, Shift, Control, Alt) are currently pressed, either reporting all active modifiers or checking for a specific one via its exit status.
1Download
- modcheck 1.0 (2025-10-11)
2Features
- Real-time modifier detection - Queries X11 keyboard state directly
- Exit status checking - Returns 0/1 for scripting and automation
- Multiple modifier support - Detects Super, Shift, Control, and Alt keys
- Left/right key detection - Checks both left and right variants of each modifier
- Flexible output - Print all modifiers or check a specific one
- Lightweight - Single-file C program with minimal dependencies
3Dependencies
Build time:
+ C compiler (gcc or clang)
+ make
+ X11 headers
Runtime:
+ X11
4Installation
Edit config.mk to match your local setup (modcheck is installed into the /usr/local namespace by default), then simply enter the following command to install (if necessary as root):
make clean install5Usage
Check all currently pressed modifiers:
modcheck
Check if a specific modifier is pressed:
if modcheck super; then
echo "Super key is pressed"
fi
Get source here.