tray

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: AGPL-3.0 Imports: 15 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"`
	Running         string `json:"running"`
	Quit            string `json:"quit"`
	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. Running carries a {count} placeholder and is written so it needs 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 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, live func() (int, error)) *Tray

New returns a tray that is not up yet. show brings the window up, quit ends lich, live counts the sessions with a process running.

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.

Jump to

Keyboard shortcuts

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