Skip to content

feat: add Cat Gatekeeper focus/break + bedtime companion#24

Merged
setkyar merged 5 commits into
mainfrom
sc-tunneled-yttrium-7250
May 31, 2026
Merged

feat: add Cat Gatekeeper focus/break + bedtime companion#24
setkyar merged 5 commits into
mainfrom
sc-tunneled-yttrium-7250

Conversation

@setkyar
Copy link
Copy Markdown
Contributor

@setkyar setkyar commented May 31, 2026

Summary

Adds a self-contained focus/break companion to the live session viewer, inspired by Cat Gatekeeper.

  • Pomodoro cycle: a background focus timer (paused while the tab is blurred/hidden/idle) triggers a full-screen cat overlay with a large MM:SS break countdown the user can't dismiss, then auto-resumes a fresh focus cycle.
  • Bedtime: a configurable bedtime shows a sleepy, dimmed cat ("Time to sleep!"), then after the sleep-reminder duration becomes a permanent per-session lock ("Locked for the night"). Opening pi-web after bedtime greets immediately; the lock clears on reload.
  • Settings (enable, focus min, break min, bedtime, sleep min) live in the command menu's Preferences section and persist in localStorage. The settings sheet shows "Next break in MM:SS" and a "Take a break now" skip button. Remaining focus survives short reloads (30-min window).

Implementation

  • New live-app-only module web/src/session/cat-gatekeeper/:
    • cat-settings.js — storage helpers + settings sheet (reuses full-screen-sheet).
    • cat-gatekeeper.js — tick-driven state machine, full-screen overlay, input blocking.
  • Cat art is a real background-removed cat video (internal/ui/live_templates/assets/cat.webm, alpha WebM) played full-screen at slower-than-realtime playback, with a top countdown box and a gentle fade entrance.
  • Wiring: session.js starts the controller; menu item added in internal/ui/live_menu.go + handled in command-menu.js; overlay/cat CSS in session.css.
  • Per-tick focus decrement is clamped so a throttled background tab can't burn focus time on resume.

Test plan

  • make check green: frontend tests (incl. cat-gatekeeper unit tests) + Go tests + build + vet
  • Unit tests cover pause-on-blur, break entry/exit/reset, skip-to-break, disabled, focus persistence, and the bedtime sleep → lock path
  • Live browser click-through not performed (a running pi-web instance held the state-file lock, preventing a local test server; no browser automation available)

setkyar added 5 commits May 31, 2026 22:42
A self-paced pomodoro companion for the live session viewer. A background
focus timer (paused while the tab is blurred/hidden) triggers a full-screen
cat overlay with a break countdown the user can't dismiss, then resumes a
fresh focus cycle. A configurable bedtime shows a sleepy cat that locks
pi-web for the rest of the session. Settings (enable, focus/break minutes,
bedtime, sleep duration) live in the command menu and persist in
localStorage; remaining focus survives short reloads.
Replace the drawn SVG cat with a looping, muted WebM clip served at
/cat.webm (embedded via go:embed, range-served). The break and bedtime
overlays reuse the same video; the sleepy variant is a CSS grayscale/dim
filter. The asset is a user-supplied clip, so no third-party rights apply.
Mask the cat out of the clip with Apple's Vision foreground segmentation
and re-encode as a VP9 WebM with alpha (yuva420p). The overlay now shows
the cat as a floating cutout — no card/frame, just a soft drop shadow —
on the dark backdrop.
… box

Match the Cat Gatekeeper presentation: the cat fills the viewport and
slides in from the side over ~2.8s, playback runs at 0.6x for a calmer
vibe, and the countdown lives in its own translucent box at the top so
text never overlaps the cat. The break overlay drops its descriptive
message (timer only); the sleepy overlay keeps its short message.
A horizontal slide reads as the cat gliding across the screen, which looks
wrong for a lounging (non-walking) cat. Replace it with a soft fade + rise +
scale settle-in.
@setkyar setkyar merged commit 320226f into main May 31, 2026
1 check passed
@setkyar setkyar deleted the sc-tunneled-yttrium-7250 branch May 31, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant