mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
[PR #973] [MERGED] Add dynamic tray menu update functionality #1395
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ElectronNET/Electron.NET/pull/973
Author: @davidroth
Created: 12/10/2025
Status: ✅ Merged
Merged: 12/11/2025
Merged by: @FlorianRappl
Base:
develop← Head:set-menu-items📝 Commits (1)
218b998Add dynamic tray menu update functionality📊 Changes
4 files changed (+52 additions, -13 deletions)
View changed files
📝
src/ElectronNET.API/API/Tray.cs(+23 -1)📝
src/ElectronNET.Host/api/tray.js(+13 -5)📝
src/ElectronNET.Host/api/tray.js.map(+1 -1)📝
src/ElectronNET.Host/api/tray.ts(+15 -6)📄 Description
Introduced a SetMenuItems method in Tray.cs to enable dynamic updates to the tray's context menu. This method clears the existing menu items, adds new ones, and registers the necessary click handlers.
Previously, updating menu item properties (such as changing the enabled state) required deleting and recreating the entire tray. Although this was functional, it caused noticeable flickering of the tray icon because the icon was briefly removed and then re-added.
With this change, the tray icon remains constant, and only the menu items themselves are replaced.
With the existing api
With the new api
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.