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

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14425
Author: @zadjii-msft
Created: 11/22/2022
Status: Closed

Base: mainHead: dev/migrie/fhl/7718-notifications


📝 Commits (10+)

  • ce375fa send notifications, and get callbacks (in an entirely new instance. Huh.)
  • 65bc163 stash, I never finished this before my kid was born
  • 67d8548 Merge branch 'main' into dev/migrie/fhl/7718-notifications
  • 006da6a As a test, hook this up to BELs
  • f0f75dc Actually parse parameters from the notification
  • e9b2e51 Plumbing is always the most work
  • 1fd87fe only send when inactive
  • 054f173 cleanup
  • 0f339d2 revert some dead code
  • 8e170eb oops

📊 Changes

40 files changed (+391 additions, -2 deletions)

View changed files

📝 .github/actions/spelling/allow/allow.txt (+1 -0)
📝 src/cascadia/Remoting/WindowManager.cpp (+31 -0)
📝 src/cascadia/Remoting/WindowManager.h (+2 -0)
📝 src/cascadia/Remoting/WindowManager.idl (+2 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+110 -0)
📝 src/cascadia/TerminalApp/TerminalPage.h (+6 -0)
📝 src/cascadia/TerminalApp/pch.h (+3 -0)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+10 -0)
📝 src/cascadia/TerminalControl/ControlCore.h (+4 -0)
📝 src/cascadia/TerminalControl/ControlCore.idl (+2 -0)
📝 src/cascadia/TerminalControl/EventArgs.cpp (+1 -0)
📝 src/cascadia/TerminalControl/EventArgs.h (+15 -0)
📝 src/cascadia/TerminalControl/EventArgs.idl (+6 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+8 -0)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)
📝 src/cascadia/TerminalControl/TermControl.idl (+1 -0)
📝 src/cascadia/TerminalCore/ICoreSettings.idl (+1 -0)
📝 src/cascadia/TerminalCore/Terminal.cpp (+6 -0)
📝 src/cascadia/TerminalCore/Terminal.hpp (+4 -0)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+10 -0)

...and 20 more files

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14425 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 11/22/2022 **Status:** ❌ Closed **Base:** `main` ← **Head:** `dev/migrie/fhl/7718-notifications` --- ### 📝 Commits (10+) - [`ce375fa`](https://github.com/microsoft/terminal/commit/ce375fa7f3778a2f9d644c89dc462802f3f90116) send notifications, and get callbacks (in an entirely new instance. Huh.) - [`65bc163`](https://github.com/microsoft/terminal/commit/65bc163da4dc6aefd91fc58c0733df6a9e18b65e) stash, I never finished this before my kid was born - [`67d8548`](https://github.com/microsoft/terminal/commit/67d854821faa57ae6b8432dc8711e2cc424d75ae) Merge branch 'main' into dev/migrie/fhl/7718-notifications - [`006da6a`](https://github.com/microsoft/terminal/commit/006da6a549362e64858e461319a9d26dad99b2fe) As a test, hook this up to BELs - [`f0f75dc`](https://github.com/microsoft/terminal/commit/f0f75dcdd08982cc438bf521c0c9119bf0624b4b) Actually parse parameters from the notification - [`e9b2e51`](https://github.com/microsoft/terminal/commit/e9b2e5184a3e58b4fffd0a641d1fbb9c633afb82) Plumbing is always the most work - [`1fd87fe`](https://github.com/microsoft/terminal/commit/1fd87fecdf9ac113bf3677002f25f7c0a9dd4d9f) only send when inactive - [`054f173`](https://github.com/microsoft/terminal/commit/054f1739950d83bc10bb21a4092fe434e768f045) cleanup - [`0f339d2`](https://github.com/microsoft/terminal/commit/0f339d2498c1504501136522f3a29259e5ad7344) revert some dead code - [`8e170eb`](https://github.com/microsoft/terminal/commit/8e170eb643e2a0aba203d0016c9ffcc0ed71d68f) oops ### 📊 Changes **40 files changed** (+391 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/allow/allow.txt` (+1 -0) 📝 `src/cascadia/Remoting/WindowManager.cpp` (+31 -0) 📝 `src/cascadia/Remoting/WindowManager.h` (+2 -0) 📝 `src/cascadia/Remoting/WindowManager.idl` (+2 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+110 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+6 -0) 📝 `src/cascadia/TerminalApp/pch.h` (+3 -0) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+10 -0) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+4 -0) 📝 `src/cascadia/TerminalControl/ControlCore.idl` (+2 -0) 📝 `src/cascadia/TerminalControl/EventArgs.cpp` (+1 -0) 📝 `src/cascadia/TerminalControl/EventArgs.h` (+15 -0) 📝 `src/cascadia/TerminalControl/EventArgs.idl` (+6 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+8 -0) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+1 -0) 📝 `src/cascadia/TerminalCore/ICoreSettings.idl` (+1 -0) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+6 -0) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+4 -0) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+10 -0) _...and 20 more files_ </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:38:35 +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#30087