tray

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdderConfigPath

func AdderConfigPath() string

AdderConfigPath returns the path to the adder config file in the config directory.

func ConfigDir

func ConfigDir() string

ConfigDir returns the platform-specific directory for storing configuration files.

func ConfigExists

func ConfigExists() bool

ConfigExists reports whether the configuration file exists on disk.

func ConfigPath

func ConfigPath() string

ConfigPath returns the full path to the tray configuration file.

func GenerateAdderConfig

func GenerateAdderConfig(params AdderConfigParams) ([]byte, error)

GenerateAdderConfig builds an adder configuration from the given parameters. The API server is always enabled because adder-tray connects to its /events endpoint for desktop notifications and /healthcheck for status monitoring.

func LogDir

func LogDir() string

LogDir returns the platform-specific directory for storing log files.

func SaveConfig

func SaveConfig(cfg TrayConfig) error

SaveConfig writes the tray configuration to disk, creating the config directory if necessary.

func WriteAdderConfig

func WriteAdderConfig(params AdderConfigParams) error

WriteAdderConfig writes the adder configuration to the config directory.

Types

type AdderConfigParams

type AdderConfigParams struct {
	Network  string
	Template MonitorTemplate
	Param    string // The address/drep/pool value depending on Template
	Output   string // Output plugin name (default: "log")
	Format   string // Output format (default: "json")
}

AdderConfigParams holds the parameters for generating an adder configuration.

type App

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

App holds references to all major components of the tray application.

func NewApp

func NewApp() (*App, error)

NewApp creates and initialises the tray application.

func (*App) Run

func (a *App) Run()

Run starts the system tray and blocks until Quit is called.

func (*App) Shutdown

func (a *App) Shutdown()

Shutdown requests a graceful shutdown of the tray application and its managed adder process.

type MonitorTemplate

type MonitorTemplate int

MonitorTemplate represents a pre-configured monitoring template.

const (
	WatchWallet MonitorTemplate = iota
	TrackDRep
	MonitorPool
)

func (MonitorTemplate) String

func (t MonitorTemplate) String() string

String returns the display name of the template.

type ProcessManager

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

ProcessManager manages the lifecycle of the adder subprocess.

func NewProcessManager

func NewProcessManager(
	opts ...ProcessManagerOption,
) *ProcessManager

NewProcessManager creates a new ProcessManager with the given options.

func (*ProcessManager) IsRunning

func (pm *ProcessManager) IsRunning() bool

IsRunning reports whether the adder process is currently running.

func (*ProcessManager) Restart

func (pm *ProcessManager) Restart() error

Restart stops and then starts the adder process.

func (*ProcessManager) Start

func (pm *ProcessManager) Start() error

Start launches the adder process. Returns an error if it is already running.

func (*ProcessManager) Stop

func (pm *ProcessManager) Stop() error

Stop terminates the running adder process gracefully.

type ProcessManagerOption

type ProcessManagerOption func(*ProcessManager)

ProcessManagerOption is a functional option for ProcessManager.

func WithBinary

func WithBinary(path string) ProcessManagerOption

WithBinary sets the path to the adder binary.

func WithConfigFile

func WithConfigFile(path string) ProcessManagerOption

WithConfigFile sets the path to the adder configuration file.

type TrayConfig

type TrayConfig struct {
	// AdderBinary is the path to the adder binary.
	AdderBinary string `yaml:"adder_binary"`
	// AdderConfig is the path to the adder configuration file.
	AdderConfig string `yaml:"adder_config"`
	// AutoStart controls whether adder starts automatically
	// with the tray application.
	AutoStart bool `yaml:"auto_start"`
}

TrayConfig holds the configuration for the adder-tray application.

func DefaultConfig

func DefaultConfig() TrayConfig

DefaultConfig returns a TrayConfig with sensible defaults.

func LoadConfig

func LoadConfig() (TrayConfig, error)

LoadConfig reads the tray configuration from disk. If the file does not exist, it returns the default configuration.

Jump to

Keyboard shortcuts

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