Created
August 7, 2025 14:44
-
-
Save cnbluefire/7c4ffc51d830a4176643387c7541f7ee to your computer and use it in GitHub Desktop.
Create a Windows notification to open a url using Edge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Windows.Data.Xml.Dom; | |
| using Windows.UI.Notifications; | |
| // Edge Package AUMID | |
| const string AUMID = "Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App"; | |
| var notifier = ToastNotificationManager.CreateToastNotifier(AUMID); | |
| var xml = $$$""" | |
| <toast launch='{{{BuildLaunchId(new Uri("https://www.4399.com/"))}}}'> | |
| <visual> | |
| <binding template='ToastGeneric'> | |
| <text>Open Website</text> | |
| </binding> | |
| </visual> | |
| <actions> | |
| <action content='Open' arguments='{{{BuildLaunchId(new Uri("https://www.7k7k.com/"))}}}'/> | |
| </actions> | |
| </toast> | |
| """; | |
| var xmlDoc = new XmlDocument(); | |
| xmlDoc.LoadXml(xml); | |
| var notification = new ToastNotification(xmlDoc); | |
| notifier.Show(notification); | |
| static string BuildLaunchId(Uri uri) => | |
| // https://github.com/chromium/chromium/blob/9fb86dba30189c2d48982de69ee6d5031391248d/chrome/browser/notifications/win/notification_launch_id.cc#L87 | |
| // type|notification_type|profile_id|app_user_model_id|incognito|origin|notification_id | |
| $"0|1|Default|MSEdge|0|{uri.OriginalString}|"; |
cnbluefire
commented
Aug 7, 2025
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment