Development
Keyount is MIT-licensed and standard-library only. One hard rule for contributions: never log the key sequence, and never add network code. Counters only.
Run the tests
Section titled “Run the tests”make test # run the test suite (no keyboard / libinput needed)make lint # python compile + bash -n + JSON + systemd unit checksmake bench # full benchmarks (see BENCHMARKS.md)make bench-quick # small benchmark smoke test (also run in CI)make install # same as ./install.shThe suite (80 Python tests + shell tests) feeds sample libinput
lines into the counter’s --selftest mode, runs the live counter
end-to-end against a fake libinput shim (config, pause,
permissions, corrupted files, SIGTERM), unit-tests the shared
counting core (src/counter_core.py) and the Windows/macOS
key-classification tables directly, checks wordcount output
against a temporary $HOME, and statically verifies packaging
metadata, the systemd caps, docs/CLI consistency, and the
no-network-code rule — so everything runs anywhere, including CI.
Repo layout
Section titled “Repo layout”src/ counter_core.py (shared logic), keyount.py (Linux libinput front-end), wordcount (Linux CLI)ports/ wordcount.py — shared Windows/macOS CLIwindows/ counter_win.py, install/uninstall .ps1, tray.pymacos/ counter_mac.py, install/uninstall .sh, menubar.pywidgets/ KDE plasmoid, GNOME extension, Cinnamon applet, XFCE/Waybar/Polybar/i3blocks/Conky/MATE/LXQt snippetsscripts/ install-widgets.sh (desktop auto-detect)systemd/ user service unitpackaging/ PyInstaller standalone-binary builds (build.py)tests/ unittest + shell testsbenchmarks/ bench.pysite/ this documentation site (Astro + Starlight)How it works
Section titled “How it works”keyboard ──► kernel evdev ──► libinput debug-events --show-keycodes │ ▼ src/keyount.py (counts only, discards the key) │ ▼ ~/.local/share/keyount/YYYY-MM-DD.json │ ┌─────────────────┼─────────────────┐ ▼ ▼ ▼ wordcount CLI KDE plasmoid XFCE genmon (today/week) (30s poll) (30s poll)Windows replaces the libinput front-end with low-level hooks
(WH_KEYBOARD_LL / WH_MOUSE_LL) and macOS with a listen-only
CGEventTap; both feed the same src/counter_core.py state
machine and write the same JSON.
This site
Section titled “This site”The docs site lives in site/ (Astro + Starlight). Local dev:
cd sitenpm installnpm run devIt makes zero external requests (system fonts, no analytics, no
CDN) — same rules as the counter. Deployment notes are in
site/README.md in the repo.
Contributing
Section titled “Contributing”Issues and pull requests are welcome — see CONTRIBUTING.md in
the repo. Please keep changes counters-only, stdlib-only, and
covered by tests.
License
Section titled “License”MIT © 2026 Chandan Shakya.