Add a setting for sending a notification on BEL#20011
Conversation
|
The only change I made was I changed the settings UI string from "Send notification" to "Desktop notification"
Separately, I noticed that the default here is
I also played around with it and I noticed this:
4. Click notification
5. Get a new Terminal window!
I double checked and we are hitting this code in terminal/src/cascadia/TerminalApp/AppCommandlineArgs.cpp Lines 1071 to 1078 in 4357c17 Shouldn't we refocus the tab/pane that sent the notification instead? @zadjii-msft thoughts? |
4357c17 to
aeb531f
Compare
324223d to
a1048d0
Compare
| // Send a desktop toast notification if requested, but only if | ||
| // the pane isn't already in the belled state. This prevents | ||
| // sending repeated toasts for repeated BEL characters. | ||
| if (bellArgs.SendNotification() && !tab->_tabStatus.BellIndicator()) | ||
| { | ||
| tab->TabToastNotificationRequested.raise(tab->Title(), L"", tab->TabViewIndex()); | ||
| } |
There was a problem hiding this comment.
Would this send a toast every 3s if I send a bell every 3s? Is it a concern to us to throttle this even further? (I'd probably lean to "no", personally.)
There was a problem hiding this comment.
We have a throttle in DesktopNotification here:
terminal/src/cascadia/TerminalApp/DesktopNotification.cpp
Lines 20 to 34 in 9df166e
It's currently set to 5 seconds:
The flow is:
TabToastNotificationRequested --> TerminalPage::_SendDesktopNotification() --> DesktopNotification::SendNotification()
So I think the 5s throttle is good, but we can adjust it if we want.
## 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
a1048d0 to
99a2976
Compare
99a2976 to
db209a1
Compare
db209a1 to
16581fe
Compare
16581fe to
ec8f1ec
Compare
## 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
## 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
## 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


Summary of the Pull Request
Targets #20010
Adds another
bellStyleflag option. This sends a windows toast notification to the user when a BEL is encounteredHeavily based on #19936
Co-authored by @zadjii-msft