diff options
Diffstat (limited to 'desktop/modules/status/README.md')
| -rw-r--r-- | desktop/modules/status/README.md | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/desktop/modules/status/README.md b/desktop/modules/status/README.md index 571f859..6cbd2d7 100644 --- a/desktop/modules/status/README.md +++ b/desktop/modules/status/README.md @@ -53,9 +53,47 @@ for a number of minutes, in which case the singleton's timer re-enables it. The timer is shell-lifetime: a restart during a timed disable leaves the lock off until it is toggled, the same class of limit as `dndBeforePresentation`. -breaktimer owns `$XDG_RUNTIME_DIR/breaktimer.state`. This module calls -`breaktimer.sh pause|resume` and never writes that file: its daemon loop -rewrites it on every phase change, and two writers would race. +breaktimer is paused and resumed by verb, never by writing its state file. See +Breaktimer below, which is also the read direction. + +## Breaktimer + +The traffic runs both ways, and only one way writes. + +**Reading.** The daemon publishes three files the singleton watches: + + $XDG_RUNTIME_DIR/breaktimer.state running | paused | stopped + $XDG_RUNTIME_DIR/breaktimer.phase working | breaking | longbreak + $XDG_RUNTIME_DIR/breaktimer.remain seconds left in the phase + +exposed as `Status.btState`, `btPhase` and `btRemain`, with `btRunning` and +`btPaused` derived from the first. `waybar-breaktimer.sh` reads the same three +files and the two consumers do not know about each other. + +**Writing: never.** The daemon owns those files and rewrites state and phase on +every transition, so a second writer would race its loop. Every control calls a +verb through `runBreaktimer()`, which is why presentation mode has always +called `pause` rather than writing `breaktimer.state`. + +**A stopped daemon** is read from the state file, not probed. Both paths that +end the daemon write `stopped` there: `stop_daemon`, and the `cleanup` trap on +`TERM`. A daemon lost to `KILL` leaves a stale `running` and the drawer shows a +frozen countdown, a visible wrong answer the Start button resolves, which is +cheaper than a liveness probe on every repaint. QML cannot send a signal, so +the `kill -0` check the waybar module uses is not available here anyway. + +**The countdown counts in five second steps**, because that is the daemon's +tick and the shell does not interpolate between its writes. A local one second +timer would be a second clock drifting against the first, correcting itself +with a visible jump every five seconds, and it would keep counting while the +daemon is frozen outside the work window or paused. + +**The tile** shows breaktimer below every mode, so an active mode still owns +the line and breaktimer replaces only the idle `All clear`. It does not count +toward `activeCount`: a running daemon is not a mode the user switched on. + +The daemon's own configuration lives in `~/.config/breaktimer.conf` and is not +edited from here; `breaktimer.sh config` prints what is in effect. ## Waybar |
