Skip to content

Add toast notification infrastructure#20010

Merged
carlos-zamora merged 8 commits into
mainfrom
dev/cazamor/toast/base
Apr 30, 2026
Merged

Add toast notification infrastructure#20010
carlos-zamora merged 8 commits into
mainfrom
dev/cazamor/toast/base

Conversation

@carlos-zamora
Copy link
Copy Markdown
Member

@carlos-zamora carlos-zamora commented Mar 24, 2026

Summary of the Pull Request

Adds the infrastructure for toast notifications. Breakdown:

  • DesktopNotification:
    • DesktopNotificationArgs includes the struct to group all notification-related data together.
    • SendNotification() actually sends it
  • AppCommandlineArgs.cpp: added a check for the --from-toast no-op sentinel; ensures no new window is created
  • Most of the other changes are just bubbling up the notification from the TerminalPaneContent to TerminalPage
  • TabManagement.cpp: _SendDesktopNotification() does the final packaging of the notification before calling the DesktopNotification API

This supports finding the right tab when it's been reordered or even moved to a new window!
This also has expanded to support finding the right pane, which is resilient to pane swaps/closing too. When the pane can't be found, we just fallback to the tab.
If the pane is already focused, we don't send a notification.

This simply adds the infrastructure! Looks like nothing can actually take advantage of it yet, but it's been tested with the changes in #20011.

Heavily based on #19935
Co-authored by @zadjii-msft

Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
@carlos-zamora
Copy link
Copy Markdown
Member Author

carlos-zamora commented Mar 24, 2026

Some minor changes from the PR this was based on:

  1. Rate-limit race condition: compare_exchange_strong return value is now used directly
  2. UI thread safety: SummonWindowRequested is now marshaled to UI thread via Dispatcher().RunAsync()
  3. moved some comments around
  4. use C++20 designated initializer (and add const)
  5. use ApplicationDisplayName() instead of RS_(NotificationTitle) for notification title

Comment thread .github/actions/spelling/expect/expect.txt Fixed
Comment thread .github/actions/spelling/expect/expect.txt Fixed
Comment thread .github/actions/spelling/expect/expect.txt Fixed
@github-actions

This comment has been minimized.

@carlos-zamora carlos-zamora force-pushed the dev/cazamor/toast/base branch from 4357c17 to aeb531f Compare March 25, 2026 17:29
carlos-zamora and others added 2 commits March 25, 2026 13:27
## Summary of the Pull Request
Targets #20010 

Manually assign an AUMID to our process when we're running unpackaged.
Main difference from #19937 is what AUMID we use. Before, it was per
branding, but the `WindowEmperor` already appends an exe path hash for
unpackaged instances to prevent crosstalk. Here, we're just using the
same pattern: `Microsoft.WindowsTerminal.<hash>`.

Heavily based on #19937
Co-authored by @zadjii-msft
@carlos-zamora

This comment was marked as resolved.

Comment thread src/cascadia/TerminalApp/AppCommandlineArgs.cpp Outdated
Comment thread src/cascadia/TerminalApp/DesktopNotification.cpp Outdated
@github-actions

This comment has been minimized.

Comment thread src/cascadia/TerminalApp/DesktopNotification.cpp Fixed
Comment thread src/cascadia/TerminalApp/DesktopNotification.cpp Fixed
Comment thread src/cascadia/TerminalApp/DesktopNotification.h Fixed
@carlos-zamora carlos-zamora merged commit e4e3f08 into main Apr 30, 2026
20 checks passed
@carlos-zamora carlos-zamora deleted the dev/cazamor/toast/base branch April 30, 2026 00:24
carlos-zamora added a commit that referenced this pull request May 4, 2026
## Summary of the Pull Request
Targets #20010 

Adds another `bellStyle` flag option. This sends a windows toast
notification to the user when a BEL is encountered

- [X] Closes #18605 
- [ ] Documentation updated

Heavily based on #19936 
Co-authored by @zadjii-msft
Qmoony pushed a commit to Qmoony/terminal that referenced this pull request May 11, 2026
## Summary of the Pull Request
Adds the infrastructure for toast notifications. Breakdown:
- `DesktopNotification`:
- `DesktopNotificationArgs` includes the struct to group all
notification-related data together.
   - `SendNotification()` actually sends it
- `AppCommandlineArgs.cpp`: added a check for the `--from-toast` no-op
sentinel; ensures no new window is created
- Most of the other changes are just bubbling up the notification from
the `TerminalPaneContent` to `TerminalPage`
- `TabManagement.cpp`: `_SendDesktopNotification()` does the final
packaging of the notification before calling the `DesktopNotification`
API

This supports finding the right tab when it's been reordered or even
moved to a new window!
This also has expanded to support finding the right pane, which is
resilient to pane swaps/closing too. When the pane can't be found, we
just fallback to the tab.
If the pane is already focused, we don't send a notification.

This simply adds the infrastructure! Looks like nothing can actually
take advantage of it yet, but it's been tested with the changes in
microsoft#20011.

Heavily based on microsoft#19935
Co-authored by @zadjii-msft
Qmoony pushed a commit to Qmoony/terminal that referenced this pull request May 11, 2026
## Summary of the Pull Request
Targets microsoft#20010 

Adds another `bellStyle` flag option. This sends a windows toast
notification to the user when a BEL is encountered

- [X] Closes microsoft#18605 
- [ ] Documentation updated

Heavily based on microsoft#19936 
Co-authored by @zadjii-msft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants