Documentation
¶
Index ¶
Constants ¶
const ActionUpdate = "update"
ActionUpdate opens a terminal running `lerd update` rather than a command.
Variables ¶
This section is empty.
Functions ¶
func ActionMessage ¶
ActionMessage is the notification for a finished menu action: what was done, or what failed with the last line lerd printed. Opening the dashboard shows itself, so only its failure is reported.
Types ¶
type Getter ¶
type Getter func(path string) (io.ReadCloser, error)
Getter fetches one lerd API path, over HTTP for a tray or in process for lerd-ui.
type Menu ¶
type Menu struct {
Running bool `json:"running"`
HighContrastIcon bool `json:"high_contrast_icon"`
LatestVersion string `json:"latest_version,omitempty"`
Items []MenuItem `json:"items"`
}
Menu is the tray menu resolved from lerd's state, for clients that draw it themselves: the desktop app, or a status bar module. Labels carry no glyphs.
func BuildMenu ¶
func BuildMenu(snap *Snapshot, opts MenuOptions) Menu
BuildMenu resolves the menu for snap. A client keeps its tray for as long as it runs, so the native tray's "Turn off system tray" has no place here.
type MenuItem ¶
type MenuItem struct {
Label string `json:"label,omitempty"`
Detail string `json:"detail,omitempty"`
Tooltip string `json:"tooltip,omitempty"`
State State `json:"state,omitempty"`
Checked *bool `json:"checked,omitempty"`
Action string `json:"action,omitempty"`
Separator bool `json:"separator,omitempty"`
Items []MenuItem `json:"items,omitempty"`
// Args is the lerd command behind Action; nil for update, which is not one.
Args []string `json:"-"`
}
MenuItem is one row. Action is the id to post back to run it; a row without one is information. Checked is set only on toggles and choices.
type MenuOptions ¶
type MenuOptions struct {
LANToggle bool // false on macOS, where gvproxy always exposes ports 80/443
}
MenuOptions are the parts of the menu that depend on where lerd runs.
type ServiceInfo ¶
type ServiceInfo struct {
Name string `json:"name"`
Status string `json:"status"`
Paused bool `json:"paused,omitempty"`
QueueSite string `json:"queue_site,omitempty"`
ScheduleWorkerSite string `json:"schedule_worker_site,omitempty"`
StripeListenerSite string `json:"stripe_listener_site,omitempty"`
ReverbSite string `json:"reverb_site,omitempty"`
HorizonSite string `json:"horizon_site,omitempty"`
WorkerSite string `json:"worker_site,omitempty"`
}
type Settings ¶
type Settings struct {
Autostart bool
LANExposed bool
LANServicesExposed bool
Dumps bool
Notifications bool
HighContrastIcon bool
LatestVersion string // e.g. "v1.2.0" when an update is available
}
Settings are the persisted lerd toggles the tray menu shows.
func LocalSettings ¶
func LocalSettings() Settings
LocalSettings reads the tray's settings from this machine. The toggles come straight from the config, so the tray shows persisted intent.
type Snapshot ¶
type Snapshot struct {
Running bool
NginxRunning bool
DNSOK bool
DNSDegraded bool // lerd-dns healthy but the system resolver is bypassed, typically a VPN
DNSDisabled bool // explicit dns.enabled=false from API; zero value falls through to ok/error
PHPVersions []PHPInfo
PHPDefault string
Services []ServiceInfo
ServicesKnown bool // the services call answered; an empty list means none, not unread
WorkersRunning int // per-site worker units currently up
WorkersDown []string // sites lerd considers unhealthy, not merely stopped
AutostartEnabled bool
LANExposed bool // lerd lan expose state — drives the LAN toggle item
LANServicesExposed bool // explicit managed-service LAN access preference
DumpsEnabled bool // lerd dump on/off state — drives the dump toggle item
NotificationsEnabled bool // lerd notify on/off state — drives the notifications toggle item
HighContrastIcon bool // lerd tray icon high-contrast state — green running icon on any panel
LatestVersion string // non-empty (e.g. "v0.8.5") when a newer version is available
}
Snapshot holds the state polled from the Lerd API.
func ReadSnapshot ¶
ReadSnapshot reads the tray's state from lerd's API through get, and the toggles through settings, which is only asked once the API has answered.