systray

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package systray is a thin wrapper over fyne.io/systray that places the application in the OS system tray with clickable menu items, giving the desktop build parity with native apps (for example, surfacing alarms from a tray menu).

fyne.io/systray exposes a package-level, singleton API; Tray collects the ready hook and menu items behind a small object so a host can configure the tray, then drive its event loop with Run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tray

type Tray struct {
	// contains filtered or unexported fields
}

Tray wraps the fyne.io/systray package-level API. The zero value is not usable; construct one with New.

func New

func New() *Tray

New returns a Tray with no ready hook or menu items registered yet.

func (*Tray) AddItem

func (t *Tray) AddItem(title, tooltip string, onClick func())

AddItem adds a clickable menu item. onClick is invoked every time the item is selected, on a goroutine that ranges over the item's click channel; the goroutine exits when the tray shuts down and the channel is closed.

func (*Tray) OnReady

func (t *Tray) OnReady(fn func())

OnReady registers a callback invoked once, when the tray is initialised and ready. Icon and menu-item calls should be made from within it (or after it has fired).

func (*Tray) Quit

func (t *Tray) Quit()

Quit stops the tray and unblocks Run.

func (*Tray) Run

func (t *Tray) Run()

Run starts the tray event loop and blocks until Quit is called, so hosts typically invoke it on the main goroutine.

func (*Tray) SetIcon

func (t *Tray) SetIcon(icon []byte)

SetIcon sets the tray icon from raw image bytes (PNG on macOS/Linux, ICO on Windows). Call it from the OnReady callback, once the tray exists.

Jump to

Keyboard shortcuts

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