Skip to content

Add settings for "notifying" on "activity" - #19935

Closed
Mike Griese (zadjii-msft) wants to merge 11 commits into
mainfrom
dev/migrie/fhl-spring26/activity-notifications
Closed

Mike Griese (zadjii-msft) wants to merge 11 commits into
mainfrom
dev/migrie/fhl-spring26/activity-notifications

Conversation

@zadjii-msft

Copy link
Copy Markdown
Member

This PR basically implements what I proposed in this comment(#7955 (comment)). It adds three settings:

  • notifyOnInactiveOutput: send a "notification"(below) of some kind when an inactive tab has new output.
  • notifyOnNextPrompt: Similarly, but when we get a new prompt start (requires shell integration)
  • autoDetectRunningCommand: attempt to automatically detect the progress state of this profile

the "notifications" of the notifyOn* settings take a flags enum of tab|audible|taskbar|notification, which can be combined as you want. Their meanings are:

  • taskbar: flash the taskbar
  • audible: emit an audible bell (This will use the sounds from bellSounds, if specified)
  • tab: display an icon in the tab (ala terminal activity indicator/alert when in background #7955 (comment) ) (basically, similar to the bell icon)
  • notification: send a desktop "toast" (read: notification). Clicking that notification will focus the tab that sent it

and then for autodetect running commands, we only support:

  • disabled (default): don't do this
  • automatic: (requires shell integration) if we got a FTCS_COMMAND_EXECUTED  (133;C), then any output, set our progress state to indeterminate
  • I didn't end up implementing progress, because walking the buffer sounded... not great.
  • most of this is from this 2023 branch

Profiles to test with:

"defaults":
{
	"autoDetectRunningCommand": "automatic",
	"autoMarkPrompts": true, // Needed even when your OMP config has shell integration enabled
	"rightClickContextMenu": true,
	"showMarksOnScrollbar": true
},
"list":
[
	{
		"commandline": "pwsh -nologo",
		"name": "inactive output",
		"notifyOnInactiveOutput":
		[
			"taskbar",
			"audible",
			"tab",
			"notification"
		]
	},
	{
		"commandline": "pwsh -nologo",
		"name": "Next Prompt",
		"notifyOnNextOutput":
		[
			"taskbar",
			"audible",
			"tab",
			"notification"
		]
	},

Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
Comment thread src/cascadia/TerminalApp/Tab.cpp Fixed
@microsoft-github-policy-service microsoft-github-policy-service Bot added Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. labels Mar 4, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

};

[flags]
enum OutputNotificationStyle

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These enums and the properties that use them are not consumed by TermControl; it seems like they are an app level concern and should not be present in the TermControl layer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fwiw noted)

}

// Method Description:
// - Raised when output stops being produced for ~100ms (debounced).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an implementation detail. also, isn't 100ms actually casually insane for something that should notify the user? the segments of a user's prompt might take that long to print

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 5, 2026
@DHowett

Copy link
Copy Markdown
Member

In general, I think I would prefer one PR that adds the notification infrastructure so that all the PRs can be stacked on top of that one, rather than them all depending on possibly the most contentious one of the stack.

Ergo,

Add notification infrastructure
|- add activity
|- add bell
|- add AUMID
|- add OSC777

rather than

Add activity notifier and notification infrastructure
|- add bell
   |- add aumid
      |- add OSC 777

@zadjii-msft

Copy link
Copy Markdown
Member Author

rather than them all depending on possibly the most contentious one of the stack.

this is a totally reasonable take. I can work on that.

@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 5, 2026
@carlos-zamora

Copy link
Copy Markdown

Chatted with Mike. Got positive handoff and took notes of the PRs, feedback, and other relevant notes he had on the subject. Closing this and others so that they don't clutter our PR queue.

Carlos Zamora (carlos-zamora) pushed a commit that referenced this pull request Apr 30, 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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Attention The core contributors need to come back around and look at this ASAP. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.

Projects

None yet

4 participants