[PR #14425] Add support for OSC777 - send notification #30092

Open
opened 2026-01-31 09:38:36 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/14425

State: closed
Merged: No


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.

This can be used in PowerShell as follows:


Write-Output "`e]777;notify;Hello From the Terminal;This is a notification sent by the client application`a"
 
# but do it with a sleep, because notifications while the Terminal is the FG window won't do anything
sleep 2; write-Output "`e]777;notify;Hello From the Terminal;This is a notification sent by the client </text><text>application`a"

other details

todo

**Original Pull Request:** https://github.com/microsoft/terminal/pull/14425 **State:** closed **Merged:** No --- 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. This can be used in PowerShell as follows: ```pwsh Write-Output "`e]777;notify;Hello From the Terminal;This is a notification sent by the client application`a" # but do it with a sleep, because notifications while the Terminal is the FG window won't do anything sleep 2; write-Output "`e]777;notify;Hello From the Terminal;This is a notification sent by the client </text><text>application`a" ``` * closes #7718 * gifs in that thread ### other details * The notification is only sent if the tab is inactive, or the window is inactive. * When a user clicks on a notification, it launches a new `windowsterminal.exe`. So we've got to be able to send a notification to the existing window, WITHOUT registering as the monarch. That's what `WindowManager::SummonForNotification` is all about. * Future places we could use this: * #6372 * #7955 ### todo * [x] Elevated? - see https://github.com/microsoft/terminal/pull/14425#issuecomment-1334149539 - This plain-old isn't possible. * [x] Unpackaged? - same as elevated, we're just ignoring this for now. - > Do not use this overload when creating a toast notifier for a desktop app. Use [CreateToastNotifier(appID)](https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.toastnotificationmanager.createtoastnotifier?view=winrt-22621#windows-ui-notifications-toastnotificationmanager-createtoastnotifier(system-string)) to supply the required [AppUserModelID](https://learn.microsoft.com/en-us/windows/desktop/shell/appids). * [x] XML injection? - Looks like they handled this for us ![image](https://user-images.githubusercontent.com/18356694/205130276-3f04bf67-8d9c-4286-aaff-71db090253ad.png) * [ ] Doesn't work on Windows 10? https://github.com/microsoft/terminal/pull/14425#discussion_r1043340579
claunia added the pull-request label 2026-01-31 09:38:36 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30092