Add Focus Timer widget - #403
Merged
AllTerrainDeveloper merged 1 commit intoJul 23, 2026
Merged
Conversation
A focus countdown widget you add from the widget picker. Pick a duration (presets 5/15/25/45 min or ±1-min steppers), optionally link it to one of your open windows, and start. When time is up the linked window shakes (via the public Window.shake()) and a Web Audio alarm rings until you press Stop. Option to show or hide the remaining time while running. The timer lives in a page-wide runtime (window.__desktopModeFocusTimer) so it survives widget re-renders/re-docks, and mirrors its state to ctx.storage so a running countdown resumes across a page reload. Pure client-side: no REST routes, no server state, no external services, no bundled audio. Wires src/plugins/focus-timer-widget/ (view + timer + alarm), the PHP registration in includes/widgets/widget-focus-timer.php, the Vite target, and the build script.
Collaborator
|
By the PR description it already looks promising! Let me test it! |
AllTerrainDeveloper
approved these changes
Jul 23, 2026
Collaborator
|
@Alexismlg You've been honoured in our hall of fame |
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #410
Summary
Adds a Focus Timer widget — a focus/countdown timer you add from the widget picker. Pick a duration, optionally link it to one of your open windows, and start. When time is up the linked window shakes (via the public
Window.shake()) and a gentle alarm rings until you press Stop.Built following the
starter-widgettemplate and using only public APIs + runtime globals — no framework internals touched.Features
Window.shake()until dismissed). Only currently-open windows are offered, and closing the linked window while the timer runs cancels it with a toast (the runtime listens fordesktop-mode-window-closed).ctx.storage).Implementation
src/plugins/focus-timer-widget/index.ts— the view. Useswpd-select(window picker) +wpd-checkbox-label(toggle) and native buttons, with__/sprintffromsrc/i18n.timer.ts— a DOM-independent state machine (idle / running / paused / finished) held onwindow.__desktopModeFocusTimerso it survives re-mounts; persists toctx.storage.alarm.ts— Web Audio alarm; the AudioContext is primed on the Start click (a user gesture) so it can fire minutes later.desktop.ts— a thin typed accessor overwp.desktop.windowManagerto list + shake windows.styles.css— layout only; overrides--desktop-mode-text/--desktop-mode-mutedon the dark-glass card (same approach as the Note Pad widget) so thewpd-*components stay legible.includes/widgets/widget-focus-timer.php— registration (no REST, no server state, no external services).desktop-mode.php,vite.config.js(widget-focus-timertarget), andpackage.json(build:widget-focus-timer+ thebuildchain).Pure client-side — no REST routes, no server state, no network calls.
Testing
npm run build:widget-focus-timer,npm run typecheck, andnpm run lint(on the new sources) all pass.Notes / open questions