Skip to content

v0.2.0 — Multi-Tray Fix + Dynamic Menu Updates

Choose a tag to compare

@kolkov kolkov released this 27 Jul 08:29
· 13 commits to main since this release
a461197

Added

  • Dynamic menu updates: MenuItem.SetLabel(), SetChecked(), SetDisabled(), SetIcon() — update native menu items in-place without rebuilding the entire menu (Qt6 QAction pattern)
  • MenuItemUpdater interface — optional platform interface for dispatching live menu updates
  • Windows: SetMenuItemInfoW for in-place menu item updates (MIIM_STRING + MIIM_STATE)
  • macOS: NSMenuItem setTitle/setState/setEnabled via itemWithTag: lookup
  • Linux: D-Bus ItemsPropertiesUpdated signal for individual menu item property changes

Fixed

  • macOS multi-tray: replace global activeTray singleton with per-instance trayRegistryMap keyed by ObjC target — each tray now correctly receives its own callbacks (#7)
  • Linux multi-tray: use dbus.ConnectSessionBus() (private connection per tray) instead of shared singleton, and unique PID-{trayID} bus name suffix per SNI spec (#7)

Changed

  • Breaking: Menu.Add(), AddCheckbox(), AddSubmenu(), AddWithIcon() now return *MenuItem instead of *Menu — enables dynamic updates on the returned item handle (#8)
  • Menu.AddSeparator() still returns *Menu for chaining (separators don't need dynamic updates)
  • deps: goffi v0.6.0 → v0.6.2

Migration

// Before (v0.1.x) — chaining:
menu := systray.NewMenu().Add("Open", fn).AddSeparator().Add("Quit", fn)

// After (v0.2.0) — Add returns *MenuItem:
menu := systray.NewMenu()
openItem := menu.Add("Open", fn)
menu.AddSeparator()
quitItem := menu.Add("Quit", fn)

// Dynamic updates (new!):
openItem.SetLabel("Open File")
quitItem.SetDisabled(true)