A lightweight macOS daemon that tracks how much time you spend in Japanese immersion tools — automatically, in the background.
Kansa watches the frontmost application every 500ms and tracks accumulated foreground time for a set of immersion-related programs:
- Anki
- mpv
- ttsu
- asbplayer
- VLC
Sessions are persisted to a local SQLite database (kansa.db), keyed by
program and date, so time spent accumulates across the day even if you
switch apps and come back.
Build:
go build -o kansa .Start the daemon:
./kansaRuns in the background, writing logs to kansa.log and its PID to
kansa.pid in the working directory.
View accumulated time:
./kansa reportStop the daemon:
kill $(cat kansa.pid)- Detects the active app via AppleScript (
osascript+ System Events). - Tracks per-program state transitions (Running / Paused) in memory.
- On each pause, upserts that day's accumulated duration into SQLite.
reportreads directly from the database and prints totals per program per day.
- macOS (uses AppleScript to detect the frontmost app)
- Go 1.23+
Actively developed, single-user tool. Currently macOS-only.