Catmodoro: a Rust focus timer with a small animated companion

A look at Jose Sustaita’s October 2026 Catmodoro update: accurate elapsed time, pause and restart behavior, terminal cleanup, and a Docker launch path.

Catmodoro is my Rust terminal focus timer. Its public history goes back to 2024, and an October 2026 refresh added a small animated cat and a Docker bootstrap workflow. This post looks at that update through the behavior of the program: how time advances, what pause means, and how the application leaves a terminal when it closes.

The visible interface is compact. There is a countdown, a progress gauge, a companion, and a short list of keys. Sessions default to 25 minutes, with a configurable duration from 1 to 1,440 whole minutes. Completion keeps the timer open so the user can restart or quit.

Measure elapsed time instead of counting redraws

The timer state keeps a total duration, remaining duration, and the last tick’s Instant. On each active tick, the program subtracts the elapsed duration from the remaining time. It does not assume that every pass through the event loop takes exactly the same amount of time. The rendering loop can wait for keyboard input without becoming the definition of a second.

The subtraction saturates at zero. If the next update arrives after the session should have finished, the remaining duration becomes zero and stays there. In the timer implementation and tests, a regression test advances a one-minute timer past completion, then advances it again to check this behavior.

Pause is a state transition

Pressing p or Space first accounts for the elapsed active time, then toggles the paused state. Ticks still update the time reference while paused, but do not subtract from the countdown or advance the cat’s animation frame. On resume, time spent paused is excluded.

Restart sets the remaining time back to the full session, clears the paused state, and resets the animation frame. Separate tests cover pausing and restarting. These are small operations, but giving each one a clear meaning makes the interface easier to reason about than scattering adjustments throughout keyboard handlers.

Keep the companion optional

The cat changes appearance for active, paused, and completed sessions. Its movement can be disabled at launch with --no-animation or toggled with a during a session. The countdown and keyboard controls remain usable with a still companion. Decorative movement does not carry the only explanation of whether the timer is running.

Terminal cleanup is handled by a session guard. Its Drop implementation attempts to disable raw mode, leave the alternate screen, and show the cursor again. Normal exits and error unwinding therefore share one cleanup path. This does not promise recovery from every possible process termination, but it makes cleanup part of the application’s structure.

Make the first run understandable

The README documents both a native Rust workflow and a Docker workflow. After cloning the repository, ./scripts/bootstrap.sh checks for Docker and Compose before launching the timer. Its doctor command checks the environment, and its test command supports a noninteractive smoke check. Interactive countdown sessions require a terminal.

The Docker build runs the Rust tests before building the release binary, then copies that binary into a separate runtime image using a non-root user. The repository keeps these setup steps close to the program itself, so someone exploring the project can inspect the timer and its launch process together.

Catmodoro is a small project with concrete engineering questions: elapsed time, explicit state, optional motion, and cleanup. The public source is a compact place to follow those decisions from input to behavior.

LET’S COMPARE NOTES

Join the conversation.

Have a question or something to add? Comments are reviewed before appearing. Keep it thoughtful and on topic.