tray

package
v0.93.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tray keeps lich in the system tray: the one thing on screen that says a lich whose window is closed is still running its sessions, and the way back to the window or out of lich from there.

The menu's words are the window's: the interface language lives in the window, so the window hands its translated labels over (SetLabels), and the tray comes up with the first of them. A lich whose window never opened shows no tray, and has the error that kept it from opening on screen instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DevICO

func DevICO(icon []byte) ([]byte, error)

DevICO is icon, an ICO whose images are all PNG, with each image painted as DevPNG paints one. An ICO image stored as a bitmap is an error.

func DevPNG

func DevPNG(icon []byte) ([]byte, error)

DevPNG is icon with its light parts, the flame, painted devFlame by how light they are; the dark ground stays as it is.

Types

type Icons

type Icons struct {
	PNG []byte
	ICO []byte
}

Icons are the two encodings the platforms take: PNG for the Linux StatusNotifierItem and the macOS menu bar, ICO for the Windows notification area.

type Labels

type Labels struct {
	Show            string `json:"show"`
	Quit            string `json:"quit"`
	NoSessions      string `json:"noSessions"`
	NeedsYou        string `json:"needsYou"`
	Working         string `json:"working"`
	Idle            string `json:"idle"`
	More            string `json:"more"`
	Waiting         string `json:"waiting"`
	Done            string `json:"done"`
	ServicesRunning string `json:"servicesRunning"`
	ShowOutput      string `json:"showOutput"`
	Restart         string `json:"restart"`
	Stop            string `json:"stop"`
	StopAll         string `json:"stopAll"`
}

Labels are the menu's words, in the interface language. Idle, More and ServicesRunning carry a {count} placeholder and are written so they need no plural form.

type Services added in v0.79.0

type Services struct {
	Running func() []api.Service
	Reveal  func(id string)
	Stop    func(id string)
	Restart func(id string)
	StopAll func()
}

Services is what the tray reads and does about the project services. Reveal opens a service's console in the window.

type Sessions added in v0.86.0

type Sessions struct {
	Live   func() ([]api.Peer, error)
	Status func(id string) api.SessionStatus
	Unread func() (map[string]bool, error)
	Focus  func(id string)
}

Sessions is what the tray reads and does about the sessions. Live lists the sessions with a process running, in the sidebar's order; Status is the state each last reported, as the window was told it; Unread is the set whose last turn nobody has read; Focus brings the window up on a session's card.

type Tray

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

Tray is lich's tray icon and its menu.

func New

func New(icons Icons, show func(), quit func() error) *Tray

New returns a tray that is not up yet. show brings the window up, quit ends lich.

func (*Tray) SetLabels

func (t *Tray) SetLabels(_ context.Context, opts api.TrayLabels) (api.None, error)

SetLabels gives the menu its words. The first call puts the tray up; a later one, after the language changed, rewrites the menu in place.

func (*Tray) SetServices added in v0.79.0

func (t *Tray) SetServices(s Services)

SetServices wires the project services into the menu. Startup wiring, called before the window can put the tray up.

func (*Tray) SetSessions added in v0.86.0

func (t *Tray) SetSessions(s Sessions)

SetSessions wires the sessions into the menu. Startup wiring, called before the window can put the tray up.

Jump to

Keyboard shortcuts

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