-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for OSC777 - send notification #14425
base: main
Are you sure you want to change the base?
Conversation
<toast>\ | ||
<visual>\ | ||
<binding template=\"ToastGeneric\">\ | ||
<text></text>\ | ||
<text></text>\ | ||
</binding>\ | ||
</visual>\ | ||
</toast>" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lemme tell you, it's a disaster. At least the sample has like, 25% c++winrt code these days. The original sample was "Well, the API it hard to use, so go get this third party nuget package, and do some C#" 🤦
Is there going to be an optional WinToast notification as well users can set in settings.json or Settings UI (Similar to BEL where we could have visual, audio or both) where here we have "only within the Terminal, only in the Action Center or both"?) |
I'd reckon probably not. Toasts have been harder to do right in the Terminal than it's been worth (see #8592). |
The issue you linked sounds a bit different than the guide I provided within 7718 (which this PR would close) but maybe they're the same thing. |
@WSLUser You linked to https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/scheduled-toast in #7718, which looks like a guide around using a C# wrapper around the same toast notification APIs I'm using here. Windows apparently just calls all these notifications "toast notifications", which kinda muddies the water when comparing to something like Android (where Toasts and Notifications are two very different concepts). |
Oh hey, this is a problem. We might have to disable this entirely for elevated instances. The notification is obviously running unelevated. When it calls back to our app, you guessed it, it calls into the unelevated instance. We can't trivially have a notification call back to an elevated instance. We'd need to have the unelevated |
sequenceDiagram
participant OS
participant WT.exe[1]
participant WT.exe[2]
activate WT.exe[1]
WT.exe[1]->>-OS: Sends toast notification
note left of OS: some time later
OS->>+WT.exe[2]: User clicks notification
WT.exe[2]->>-WT.exe[1]: Tell [1] to restore
activate WT.exe[1]
note left of WT.exe[1]: restores to bottom<br> of z-order?
deactivate WT.exe[1]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One issue, otherwise it looks fine. But it needs to updated with the new non-multi-process model in mind right?
{ | ||
if (til::at(pairParts, 0) == L"window") | ||
{ | ||
window = std::wcstoul(pairParts[1].data(), nullptr, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parts aren't null terminated so this won't work. You can use til::to_ulong
instead.
…7718-notifications-reboot
…otifications-reboot
Note to self - pushed a merge of this with main to |
…otifications-reboot
This reverts commit 4ab628d.
…m/microsoft/terminal into dev/migrie/fhl/7718-notifications
This comment has been minimized.
This comment has been minimized.
Further notes from 4ab628d:
Does this just... not work ever? |
At this point, I'm very tempted to stick this behind velocity and only enable for Dev & Canary builds, while we sort out the foreground issues |
I'm very on the fence about this, even checked in behind velocity.
Frankly, I still don't see the value in offering this support! 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Stake in the ground)
fite-me.emoji |
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:
other details
windowsterminal.exe
. So we've got to be able to send a notification to the existing window, WITHOUT registering as the monarch. That's whatWindowManager::SummonForNotification
is all about.todo