Skip to content

feat(windows): keep reminder toasts on screen until dismissed - #154

Merged
mohak34 merged 9 commits into
mohak34:mainfrom
NGC13009:ngc13009
Nov 24, 2026
Merged

mohak34 merged 9 commits into
mohak34:mainfrom
NGC13009:ngc13009

Conversation

@NGC13009

@NGC13009 NGC13009 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On Windows and WSL the default toast disappears after a few seconds, so a permission request or a finished session is easy to miss while away from the desk.

Fixes #153

Change

Adds an opt-in windows.scenario option. The default, "default", is unchanged: nobody who leaves it alone sees a difference. With "reminder", the popup is shown through Windows PowerShell and the WinRT toast API with scenario="reminder" and a background Dismiss action, so it stays until dismissed.

Windows drops reminder toasts for an unregistered AppUserModelID, so the plugin registers a missing windows.appID under HKCU\Software\Classes\AppUserModelId with the display name OpenCode and, when Windows can read the path, its icon. An ID that already has a display name is left alone, and the plugin never removes the key.

Reminders are best-effort: when PowerShell is missing, cannot be started, fails, or exceeds five seconds, delivery falls back to the regular toast. Reminder toasts have no activation callback, so focusOnClick and onClickCommand do not run for them.

Maintainer changes on top

  • An app ID that is already registered is no longer recreated, which could have deleted another app's values.
  • The fallback also runs when PowerShell cannot be spawned at all, and a slow PowerShell start has five seconds instead of two.
  • The regular toast path is back to its original code, and the tests run the real send function as both Windows and WSL.
  • The CONTRIBUTING.md edit was reverted to keep this PR to one problem.

OpenCode version and platforms

  • OpenCode 1 and 2: both hosts share the same delivery code, so the option applies to both.
  • Windows: launches powershell. WSL: launches powershell.exe; /mnt/<drive> icon paths are translated.
  • macOS and Linux: behavior unchanged; the option is ignored.

Tested by the contributor on the original version of this PR: Windows 11 26H2, TUI, OpenCode 2.4.1.

Not tested: the current PowerShell script has not been run on Windows since the maintainer changes. WSL and OpenCode 1 have not been tried.

Evidence

  • bun test src/notify-windows.test.ts src/notify.windows-reminder.test.ts src/config.test.ts: 50 pass, 0 fail
  • bun run typecheck and bun run build: pass

The tests cover the toast XML, script and payload, config defaults and invalid values, and on both Windows and WSL: default unchanged, reminder replaces the toast, fallback when PowerShell fails or cannot start.

Screenshot from the contributor's original version, with customized prompt text:

image

Retest on Windows before release

  1. Set windows.scenario to "reminder" and windows.appID to a new name that is not registered yet.
  2. Trigger a permission request. The toast should stay until Dismiss is pressed and show the name OpenCode with its icon.
  3. Trigger a second one. It should appear the same way, with no second regular toast.
  4. Set windows.scenario back to "default". The regular banner should appear as before.

Original change: deepseek-v4.1-flash-1017; harness: OpenCode.

Reviewed with review-loop: 2 rounds with GPT-6.1 Sol. Sol verdict: approved

Generated with Claude Code using Claude Opus 5.5

Windows toasts vanished after a few seconds, so a missed alert had no way to
stay visible. windows.scenario: "reminder" now sends the toast through
PowerShell and the WinRT toast API with scenario="reminder" and a Dismiss
action, which Windows requires before it honors that scenario.

Windows silently drops reminder toasts for an AppUserModelID it does not
know, so the toast script registers windows.appID under
HKCU\Software\Classes\AppUserModelId with a display name and icon before
showing it. An unset windows.scenario still produces today's banner, and a
failed PowerShell call falls back to the regular transient toast.

Reminder toasts have no activation callback, so focusOnClick and
onClickCommand do not run for them. Verified on Windows with the new
notify-windows tests and config tests; WSL uses the same code path but was
not run on real hardware.
A broken PowerShell could delay the regular toast by five seconds; the call now times out after two. The reminder/default/fallback decision has unit tests with a stubbed execFile, and WSL /mnt icon paths are translated for the toast image the same way as the AUMID icon. Docs now state the reminder-toast registry entry and that the plugin never removes it.
The directory-plugin loader uses package.json name and exports, so the checkout loads dist/index.js and dist/tui.js and needs a build plus restart, not a shim directory.
mohak34 and others added 6 commits November 24, 2026 23:04
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on both hosts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mohak34
mohak34 merged commit eac6645 into mohak34:main Nov 24, 2026
@mohak34

mohak34 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

@NGC13009
Hey, thanks for the pr. It's merged and out in 1.2.0-beta.

I made a few fixes on top, mainly how the app ID gets registered, and I can't test on Windows here. Could you try the beta with windows.scenario set to "reminder" and report any problems? Especially whether the toast shows the right name and icon, and whether you ever get a second regular toast with it.

@NGC13009

Copy link
Copy Markdown
Contributor Author

@NGC13009 Hey, thanks for the pr. It's merged and out in 1.2.0-beta.

I made a few fixes on top, mainly how the app ID gets registered, and I can't test on Windows here. Could you try the beta with windows.scenario set to "reminder" and report any problems? Especially whether the toast shows the right name and icon, and whether you ever get a second regular toast with it.

Got it

I've tested this version and there are no issues at all.

The updated code works well: the icon and name are completely correct, and a single notification does not trigger two toast notification. it's just one reminder notification, with no extra unexpected regular toast. In other words, it works well. (When I complete another task without clearing the previous notification, the new toast appears alongside the previous uncleared notification; this is expected behavior and makes sense.)

@mohak34

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.

Feature: optional persistent ("reminder") Windows toasts

2 participants