{"id":13593816,"url":"https://github.com/HavenDV/H.NotifyIcon","last_synced_at":"2025-04-09T05:32:22.907Z","repository":{"id":39109352,"uuid":"230918035","full_name":"HavenDV/H.NotifyIcon","owner":"HavenDV","description":"TrayIcon for WPF/WinUI/Uno/MAUI","archived":false,"fork":false,"pushed_at":"2025-03-24T03:32:15.000Z","size":1961,"stargazers_count":632,"open_issues_count":38,"forks_count":50,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-06T01:01:53.766Z","etag":null,"topics":["console","context-menus","csharp","custom-balloons","dotnet","net","net5","netcore","notifyicon","nuget","popups","tooltips","tray-icon","windowsappsdk","winui","winui3","wpf","xaml"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HavenDV.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"patreon":"havendv","ko_fi":"havendv","custom":["https://www.paypal.me/havendv","https://www.buymeacoffee.com/havendv","https://www.upwork.com/freelancers/~017b1ad6f6af9cc189"]}},"created_at":"2019-12-30T13:09:08.000Z","updated_at":"2025-04-05T15:31:12.000Z","dependencies_parsed_at":"2023-10-16T16:26:43.329Z","dependency_job_id":"2d3cbb16-32da-46f9-af74-a17a4d14e073","html_url":"https://github.com/HavenDV/H.NotifyIcon","commit_stats":{"total_commits":453,"total_committers":10,"mean_commits":45.3,"dds":"0.10816777041942605","last_synced_commit":"8773b98709886dbd766c3baac2dfa086a7b835ee"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FH.NotifyIcon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FH.NotifyIcon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FH.NotifyIcon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HavenDV%2FH.NotifyIcon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HavenDV","download_url":"https://codeload.github.com/HavenDV/H.NotifyIcon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247986968,"owners_count":21028890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","context-menus","csharp","custom-balloons","dotnet","net","net5","netcore","notifyicon","nuget","popups","tooltips","tray-icon","windowsappsdk","winui","winui3","wpf","xaml"],"created_at":"2024-08-01T16:01:24.977Z","updated_at":"2025-04-09T05:32:22.901Z","avatar_url":"https://github.com/HavenDV.png","language":"C#","funding_links":["https://patreon.com/havendv","https://ko-fi.com/havendv","https://www.paypal.me/havendv","https://www.buymeacoffee.com/havendv","https://www.upwork.com/freelancers/~017b1ad6f6af9cc189"],"categories":["C#","C# #","C\\#"],"sub_categories":[],"readme":"# README\r\n\r\n### H.NotifyIcon\r\n\r\n\\*\\* This project is a continuation of the inactive base project to other platforms (WinUI/Uno.Skia.Wpf/Console) - ❤️ https://github.com/hardcodet/wpf-notifyicon ❤️ \\*\\*\r\n\r\nThis is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for .Net 6 WPF/WinUI/Uno.Skia.WPF/Console platforms. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF/WinUI frameworks in order to display rich tooltips, popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.\r\n\r\n#### Features\r\n\r\n* Notifications\r\n* [Context menus](broken-reference)\r\n* ICommand support\r\n* [Design-time access](broken-reference)\r\n* [Efficiency Mode](broken-reference)\r\n* [Dynamic icon generation](broken-reference)\r\n* Trimming/NativeAOT support\r\n\r\n#### NuGet\r\n\r\n[![NuGet](https://img.shields.io/nuget/dt/H.NotifyIcon.Wpf.svg?style=flat-square\\\u0026label=H.NotifyIcon.Wpf)](https://www.nuget.org/packages/H.NotifyIcon.Wpf/) [![NuGet](https://img.shields.io/nuget/dt/H.NotifyIcon.WinUI.svg?style=flat-square\\\u0026label=H.NotifyIcon.WinUI)](https://www.nuget.org/packages/H.NotifyIcon.WinUI/) [![NuGet](https://img.shields.io/nuget/dt/H.NotifyIcon.Uno.svg?style=flat-square\\\u0026label=H.NotifyIcon.Uno)](https://www.nuget.org/packages/H.NotifyIcon.Uno/) [![NuGet](https://img.shields.io/nuget/dt/H.NotifyIcon.Uno.WinUI.svg?style=flat-square\\\u0026label=H.NotifyIcon.Uno.WinUI)](https://www.nuget.org/packages/H.NotifyIcon.Uno.WinUI/)\r\n\r\n```powershell\r\nInstall-Package H.NotifyIcon.Wpf\r\nInstall-Package H.NotifyIcon.WinUI\r\nInstall-Package H.NotifyIcon.Uno\r\nInstall-Package H.NotifyIcon.Uno.WinUI\r\n# If you need other platforms, you can use this Core library - \r\n# it allows you to make NotifyIcon even in a console application.\r\nInstall-Package H.NotifyIcon\r\n```\r\n\r\n#### Usage\r\n\r\n```xml\r\n\u003cWindow\r\n    xmlns:tb=\"clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf\" // WPF\r\n    xmlns:tb=\"using:H.NotifyIcon\" // WinUI\r\n    \u003e\r\n    \u003ctb:TaskbarIcon\r\n        ToolTipText=\"ToolTip\"\r\n        IconSource=\"/Images/TrayIcons/Logo.ico\"\r\n        ContextMenu=\"{StaticResource TrayMenu}\"\r\n        MenuActivation=\"LeftOrRightClick\"\r\n        TrayPopup=\"{StaticResource TrayStatusPopup}\"\r\n        PopupActivation=\"DoubleClick\"\r\n        TrayToolTip=\"{StaticResource TrayToolTip}\"\r\n        /\u003e\r\n\u003c/Window\u003e\r\n```\r\n\r\n#### Efficiency Mode ![image](https://user-images.githubusercontent.com/3002068/164691691-5baf5210-5b5e-417e-99d3-d0f19006d997.png)\r\n\r\nWindows 11 introduces a new concept called [Efficiency Mode](https://devblogs.microsoft.com/performance-diagnostics/reduce-process-interference-with-task-manager-efficiency-mode/).\\\r\nSince, basically, this library is intended for applications to exist in the background with the ability to interact through TrayIcon, the library implements an API for this mode:\r\n\r\n```cs\r\nEfficiencyModeUtilities.SetEfficiencyMode(bool value)\r\nWindowExtensions.Hide(this Window window, enableEfficiencyMode: true) // default value\r\nWindowExtensions.Show(this Window window, disableEfficiencyMode: true) // default value\r\nTaskbarIcon.ForceCreate(bool enablesEfficiencyMode = true) // default value\r\n```\r\n\r\n#### Generated icons\r\n\r\nExample 1: ![image](https://user-images.githubusercontent.com/3002068/163721411-1388f2b4-a039-4b4a-8114-f74bfc8835ba.png)\r\n\r\n```xml\r\n\u003ctb:TaskbarIcon\u003e\r\n    \u003ctb:TaskbarIcon.IconSource\u003e\r\n        \u003ctb:GeneratedIconSource\r\n            Text=\"❤️\"\r\n            Foreground=\"Red\"\r\n            /\u003e\r\n    \u003c/tb:TaskbarIcon.IconSource\u003e\r\n\u003c/tb:TaskbarIcon\u003e\r\n```\r\n\r\nExample 2: ![image](https://user-images.githubusercontent.com/3002068/163721399-cbfd0286-d2d4-4b40-b3f3-388c9613f535.png)\r\n\r\n```xml\r\n\u003ctb:TaskbarIcon\r\n    IconSource=\"/Icons/Error.ico\"\r\n    \u003e\r\n    \u003ctb:TaskbarIcon.IconSource\u003e\r\n        \u003ctb:GeneratedIconSource\r\n            Text=\"5\"\r\n            Foreground=\"Black\"\r\n            FontSize=\"36\"\r\n            FontWeight=\"Bold\"\r\n            /\u003e\r\n    \u003c/tb:TaskbarIcon.IconSource\u003e\r\n\u003c/tb:TaskbarIcon\u003e\r\n```\r\n\r\nExample 3: ![image](https://user-images.githubusercontent.com/3002068/163721367-dc6878df-3ec2-4288-b699-cf664894e1b1.png)\r\n\r\n```xml\r\n\u003ctb:TaskbarIcon\u003e\r\n    \u003ctb:TaskbarIcon.IconSource\u003e\r\n        \u003ctb:GeneratedIconSource\r\n            Text=\"❤️\"\r\n            Foreground=\"Red\"\r\n            FontFamily=\"Segoe UI Emoji\"\r\n            Background=\"AliceBlue\"\r\n            FontWeight=\"Bold\"\r\n            FontSize=\"38\"\r\n            /\u003e\r\n    \u003c/tb:TaskbarIcon.IconSource\u003e\r\n\u003c/tb:TaskbarIcon\u003e\r\n```\r\n\r\nExample 4: ![image](https://user-images.githubusercontent.com/3002068/163723782-8b135584-8b35-401e-926e-0fe0e7aa801e.png)\r\n\r\n```xml\r\n\u003ctb:TaskbarIcon\u003e\r\n    \u003ctb:TaskbarIcon.IconSource\u003e\r\n        \u003ctb:GeneratedIconSource\r\n            Text=\"❤️\"\r\n            BorderThickness=\"5\"\r\n            FontSize=\"46\"\r\n            \u003e\r\n            \u003ctb:GeneratedIconSource.Foreground\u003e\r\n                \u003cLinearGradientBrush StartPoint=\"0,0\" EndPoint=\"128,128\"\u003e\r\n                    \u003cGradientStop Color=\"White\" /\u003e\r\n                    \u003cGradientStop Color=\"Red\" /\u003e\r\n                \u003c/LinearGradientBrush\u003e\r\n            \u003c/tb:GeneratedIconSource.Foreground\u003e\r\n            \u003ctb:GeneratedIconSource.BorderBrush\u003e\r\n                \u003cLinearGradientBrush StartPoint=\"0,0\" EndPoint=\"128,128\"\u003e\r\n                    \u003cGradientStop Color=\"White\" /\u003e\r\n                    \u003cGradientStop Color=\"Red\" /\u003e\r\n                \u003c/LinearGradientBrush\u003e\r\n            \u003c/tb:GeneratedIconSource.BorderBrush\u003e\r\n        \u003c/tb:GeneratedIconSource\u003e\r\n    \u003c/tb:TaskbarIcon.IconSource\u003e\r\n\u003c/tb:TaskbarIcon\u003e\r\n```\r\n\r\n#### Design-Time Access\r\n\r\nIt is recommended to pin the designer icon for easy viewing. To do this, go to Taskbar Settings -\u003e Other system tray icons and enable this icon:\\\r\n![image](https://user-images.githubusercontent.com/3002068/163700588-eb2ad5f2-45d0-4b6f-ad39-c66f96202cb5.png)\r\n\r\n#### WinUI Context menu\r\n\r\nAt the moment, three modes are implemented, each with its own pros and cons.\r\n\r\n1. Based on your MenuFlyout, a Win32 PopupMenu will be created that will call the commands attached to your MenuFlyoutItem. This is the default. ![image](https://user-images.githubusercontent.com/3002068/164977047-e8497047-0c6d-4f99-b160-bc1c1a1a6c3f.png)\r\n2. The menu will be created in your open window, in the corner of the screen.\r\n3. A second transparent window will be created and used to render the native menu.. At the moment it is in the preview stage. To do this you need to explicitly set ContextMenuMode=\"SecondWindow\"\\\r\n   ![image](https://user-images.githubusercontent.com/3002068/164977343-fab0ef4d-d1bd-4ff0-a1af-1d87f32c6400.png)\r\n\r\nAvailability of various options(depends on the version of `WindowsAppSDK` you are using):\r\n\r\n| Option       | Packaged App          | Unpackaged App        |\r\n| ------------ | --------------------- | --------------------- |\r\n| Transparency | 🟢 from 1.1.0-preview | 🟢 from 1.1.0-preview |\r\n| Borderless   | 🔷                    | 🟢 from 1.1.0-preview |\r\n| Animations   | 🟢, but with borders  | 🟢 from 1.1.0-preview |\r\n| Submenus     | 🔷                    | 🔷                    |\r\n\r\n#### Behavior that needs attention\r\n\r\n1. This implementation currently uses the Guid associated with each TrayIcon. The default is a hash function that creates a unique Guid based on the path to your file, because Windows associates the guid with the current path when TrayIcon is registered. The only way to keep the settings when changing the file path is to use [Authenticode](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/ms537359\\(v=vs.85\\)). Read more here: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa#troubleshooting\r\n\r\n### Sample Apps\r\n- [WPF](https://github.com/HavenDV/H.NotifyIcon/tree/master/src/apps/H.NotifyIcon.Apps.Wpf)\r\n- [WPF - Windowless](https://github.com/HavenDV/H.NotifyIcon/tree/master/src/apps/H.NotifyIcon.Apps.Wpf.Windowless)\r\n- [WinUI](https://github.com/HavenDV/H.NotifyIcon/tree/master/src/apps/H.NotifyIcon.Apps.WinUI)\r\n- [WinUI - Windowless](https://github.com/HavenDV/H.NotifyIcon/tree/master/src/apps/H.NotifyIcon.Apps.WinUI.Windowless)\r\n- [MAUI](https://github.com/HavenDV/H.NotifyIcon/tree/master/src/apps/H.NotifyIcon.Apps.Maui)\r\n- [Console](https://github.com/HavenDV/H.NotifyIcon/tree/master/src/apps/H.NotifyIcon.Apps.Console)\r\n\r\n### Support\r\n\r\nPriority place for bugs: https://github.com/HavenDV/H.NotifyIcon/issues\\\r\nPriority place for ideas and general questions: https://github.com/HavenDV/H.NotifyIcon/discussions\\\r\nI also have a Discord support channel:\\\r\nhttps://discord.gg/g8u2t9dKgE\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHavenDV%2FH.NotifyIcon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHavenDV%2FH.NotifyIcon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHavenDV%2FH.NotifyIcon/lists"}