desktop_tray 2026.4.19
desktop_tray: ^2026.4.19 copied to clipboard
A Flutter plugin for managing system tray icons and menus on desktop platforms (Windows, macOS, Linux).
Changelog #
2026.4.19 #
Fixed #
- Windows: tray icon now shows up when set from non-
.icoassets. The Win32LoadImageAPI only decodes.ico; passing a.pngused to returnNULLandShell_NotifyIconstill registered an empty clickable slot ("button works, icon invisible"). The plugin now falls back to GDI+ and supports.png/.jpg/.bmp/.gif. If decoding fails, the native side no longer registers an empty tray slot — it throws aPlatformExceptionwith codeICON_LOAD_FAILEDinstead.
Added #
- Comprehensive
example/app demonstrating every public API, everyTrayMenuItemtype, live icon/tooltip/checkbox updates,checkAvailable,popUpContextMenu,destroy+ rebuild, and a real-time event log. - Documented
checkAvailable()in the README API tables.
2026.4.8 #
-- fix windows warning
2026.4.4 #
Added #
- System tray icon management via
setIcon()for Windows (.ico), macOS (.pngvia base64), and Linux (.pngwith AppIndicator icon theme path). - Tooltip support via
setToolTip()(no-op on Linux where AppIndicator has no tooltip API). - Context menu builder with four item types:
TrayMenuItem— normal clickable itemTrayMenuItem.separator()— visual dividerTrayMenuItem.checkbox()— toggle item with checked stateTrayMenuItem.submenu()— nested sub-menu with child items
- Auto-incremented IDs for menu items — no external ID generator needed.
- Event listener mixin (
DesktopTrayListener) for:- Left / right mouse button press and release on the tray icon
- Menu item click with automatic ID →
TrayMenuItemresolution
- TrayMenu utility class with
findByKey()andfindById()lookups. - Linux crash prevention: deferred
GtkMenuItemdestruction viag_idle_add()to avoid libdbusmenu heap corruption. - Sandbox detection for Flatpak, Snap, Docker, and Podman environments.