Skip to content

Add toast notification infrastructure - #20010

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

Carlos Zamora (carlos-zamora) merged 8 commits into
mainfrom
dev/cazamor/toast/base

Conversation

@carlos-zamora

@carlos-zamora Carlos Zamora (carlos-zamora) commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

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 Mike Griese (@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

Carlos Zamora (carlos-zamora) commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

## 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 (carlos-zamora) merged commit e4e3f08 into main Apr 30, 2026
20 checks passed
@carlos-zamora
Carlos Zamora (carlos-zamora) deleted the dev/cazamor/toast/base branch April 30, 2026 00:24
Carlos Zamora (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
Qiujy (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
Qiujy (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
Carlos Zamora (carlos-zamora) added a commit that referenced this pull request Jun 4, 2026
## Summary of the Pull Request
targets #20010

This adds support for the `OSC 777 ; notify ; title ; body ST` sequence.
This allows client applications to send a notification to the Terminal.
When this notification is clicked, it summons the terminal window that
sent it.

## Validation Steps Performed
```pwsh
# in PowerShell. Terminal should not be focused.
sleep 2; Write-Output "`e]777;notify;Hello;This is a notification`a"
```

## PR Checklist
- [X] Closes #7718
- [ ] Documentation updated
- [X] Schema updated (if necessary)

Heavily based on #19938
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

Sponsor
SponsoredKunjungi sekarang
Promo