A cross-platform CLI tool that temporarily disables keyboard and touchpad input so you can wipe your devices clean without triggering accidental keypresses.
When activated, clean-mode disables all keyboard and touchpad/trackpad input for a configurable duration (default 10 seconds), displays a countdown timer, then re-enables everything automatically.
If the process is interrupted (Ctrl+C or SIGTERM), inputs are always re-enabled before exit.
| Platform | Mechanism | Prerequisites |
|---|---|---|
| Linux | xinput disable / xinput enable |
X11 session, xinput installed |
| macOS | hidutil property --set (UserKeyMapping) |
None |
| Windows | BlockInput Win32 API |
Must run as Administrator |
Requires Go 1.25+.
go build -o clean-mode .Cross-compile for other platforms:
GOOS=darwin GOARCH=arm64 go build -o clean-mode-macos .
GOOS=windows GOARCH=amd64 go build -o clean-mode.exe .Activates immediately, disables inputs for the duration, then exits.
./clean-modeSet the countdown duration in seconds with -t:
./clean-mode -t 15Keeps running and waits for you to press ENTER each time you want to activate a cleaning cycle. Useful if you clean your keyboard frequently during a session.
./clean-mode -i| Flag | Default | Description |
|---|---|---|
-t |
10 |
Duration in seconds |
-i |
false |
Interactive mode (wait for ENTER, repeatable) |
# Quick 5-second wipe
./clean-mode -t 5
# 20-second deep clean
./clean-mode -t 20
# Stay open, activate with ENTER whenever needed
./clean-mode -i
# Interactive mode with 15-second cycles
./clean-mode -i -t 15- Requires an X11 session (
xinputdoes not work under Wayland). - Install xinput if not present:
sudo apt install xinput(Debian/Ubuntu) orsudo pacman -S xorg-xinput(Arch). - The tool auto-discovers keyboards and touchpads by parsing
xinput list.
- Uses
hidutilto remap modifier keys to null events. No sudo required. - The key remapping is cleared when inputs are re-enabled.
- Trackpad hardware clicks still work (there is no unprivileged way to fully block them on macOS); software gestures are unaffected during the short cleaning window.
- The
BlockInputAPI requires the process to run with Administrator privileges. Right-click the executable and select "Run as administrator", or launch from an elevated terminal. - Blocks all keyboard and mouse input system-wide for the duration.
- Signal handling: Ctrl+C or SIGTERM during an active countdown will always re-enable inputs before exiting.
- Automatic restore: Inputs are unconditionally re-enabled when the countdown reaches zero.
- No persistent changes: Nothing is written to disk or modified permanently. On Linux and macOS, device state returns to exactly what it was before activation.
go test ./...With race detection:
go test -race ./...clean-mode/
main.go Entry point, CLI flags, orchestration
main_test.go Integration tests (mock blocker)
blocker/
blocker.go InputBlocker interface, DeviceInfo types
blocker_linux.go Linux implementation (xinput)
blocker_darwin.go macOS implementation (hidutil)
blocker_windows.go Windows implementation (BlockInput)
factory_{os}.go Platform-specific constructor
blocker_linux_test.go xinput parsing and mock tests
timer/
timer.go Countdown with injectable sleeper
timer_test.go Timer unit tests
display/
display.go Terminal output (box drawing, progress bar)
display_test.go Display unit tests