tray

command
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 9 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL