Skip to content

Add Windows notification handles#283

Open
Peter7896 wants to merge 1 commit into
hoodie:mainfrom
Peter7896:peter7896/windows-notification-handle-listener
Open

Add Windows notification handles#283
Peter7896 wants to merge 1 commit into
hoodie:mainfrom
Peter7896:peter7896/windows-notification-handle-listener

Conversation

@Peter7896

Copy link
Copy Markdown

Draft for #186, Windows side only.

This keeps the existing Windows show() behavior intact and adds an opt-in show_handle() path for callbacks. The first pass stays on the current Windows backend because it already exposes activation and dismissal handlers, so this avoids a backend swap while still proving the handle surface.

What changed:

  • add a Windows NotificationHandle with wait_for_action, wait_for_action_response, and on_close
  • map Windows activation into action ids, with default for body activation
  • map Windows dismissal reasons into CloseReason
  • expose the Windows handle/action/close types on Windows
  • make the action and close examples run real Windows paths instead of printing the XDG-only message
  • add Windows unit coverage for action mapping, closed compatibility, and close reason preservation

Validation run on Windows:

  • cargo check
  • cargo check --target x86_64-pc-windows-msvc --examples
  • cargo test --target x86_64-pc-windows-msvc --no-run
  • cargo test --target x86_64-pc-windows-msvc wait_for_action -- --nocapture

This is intentionally still a draft. I still need to attach the requested clean recording before marking it ready for review. My current Windows shell delivered the handle event, but did not render a clean banner capture, so I am not treating this as ready yet.

Refs #186

@Peter7896

Copy link
Copy Markdown
Author

Added a Windows recording for the action callback path:
https://github.com/Peter7896/notify-rust/blob/peter7896/pr-283-windows-action-recording/evidence/pr-283-windows-action-demo.mp4

The recording shows:

  • target\x86_64-pc-windows-msvc\debug\examples\actions.exe waiting for a toast action
  • the Windows toast rendering button a and button b
  • clicking button a returning clicked a to the caller

Local validation already run:

  • cargo fmt --check
  • git diff --check
  • cargo check
  • cargo check --target x86_64-pc-windows-msvc --examples
  • cargo test --target x86_64-pc-windows-msvc wait_for_action -- --nocapture

@Peter7896 Peter7896 marked this pull request as ready for review June 10, 2026 12:31
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