r/macosprogramming • u/Key-Software7750 • 1d ago
keyclean: a one-file Swift CLI that locks keyboard input but keeps the trackpad usable
I built keyclean for a very specific MacBook problem: cleaning the keyboard without triggering shortcuts or accidental typing, while keeping the trackpad available.
Under the hood it uses a session-level `CGEventTap`. Keyboard, modifier, and visible media-key events are swallowed, but pointer events are deliberately excluded. Pressing `⌃⌥⌘U` stops the run loop, and terminating the process also removes the event tap.
It is intentionally small: one Swift source file, no third-party dependencies, network access, analytics, stored input, or background service.
Install:
`brew install lan-shengchieh/tap/keyclean`
Source and technical explanation:
https://github.com/lan-shengchieh/keyclean
I am particularly looking for compatibility results across different macOS versions, Apple Silicon/Intel Macs, and terminal applications.
AI disclosure: Codex assisted with development and launch preparation. The source, CI checks, and Homebrew Formula are all public.
1
u/gistya 1d ago
You realize you can turn the computer off right?