Documentation
¶
Overview ¶
Command tray demonstrates github.com/crgimenes/native/tray: it puts an icon with a small menu in the system tray / menu bar and logs when items are chosen. Run it with:
go run ./examples/tray
It builds a PNG icon in memory (no asset file) and passes it as Config.Icon. macOS renders that PNG in the menu bar; Windows currently shows the default application icon instead (honoring a custom PNG there is a follow-up), so the icon "shows when possible" without any per-platform code in the caller.
The tray owns the UI event loop, so main locks the OS thread and Run blocks until "Quit" (or Stop) ends it. Set TRAY_AUTOCLOSE=1 to have it stop itself after a couple of seconds — handy for a non-interactive smoke test.
Click to show internal directories.
Click to hide internal directories.