config

package
v0.0.0-...-9759625 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config loads and represents the wrongtop user configuration.

Index

Constants

View Source
const Sample = `` /* 971-byte string literal not displayed */

Sample is an annotated example configuration, printed by `wrongtop config-sample`.

Variables

This section is empty.

Functions

func Path

func Path() string

Path returns the configuration file location: $WRONGTOP_CONFIG if set, otherwise ~/.config/wrongtop/config.yaml.

Types

type Config

type Config struct {
	Theme      string     `yaml:"theme"`
	Refresh    Duration   `yaml:"refresh"`
	Layout     string     `yaml:"layout"`  // full | compact | minimal
	Modules    Modules    `yaml:"modules"` //nolint:gocritic // grouped YAML namespace
	Thresholds Thresholds `yaml:"thresholds"`
	Keys       Keys       `yaml:"keys"`
	ReadOnly   bool       `yaml:"read_only,omitempty"` // no process signaling
	NerdFonts  bool       `yaml:"nerd_fonts,omitempty"`
	Border     string     `yaml:"border,omitempty"` // rounded | square panel corners
}

Config is the top-level wrongtop configuration.

func Default

func Default() *Config

Default returns the built-in configuration.

func Load

func Load(path string) (*Config, error)

Load reads configuration from path. An empty path means the default location; a missing file yields the defaults.

type Duration

type Duration time.Duration

Duration wraps time.Duration so it can round-trip through YAML as a human-friendly string such as "1s" or "500ms".

func (Duration) D

func (d Duration) D() time.Duration

D returns the underlying time.Duration.

func (*Duration) UnmarshalYAML

func (d *Duration) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements yaml.Unmarshaler.

type Keys

type Keys struct {
	Kill   string `yaml:"kill"`
	Filter string `yaml:"filter"`
}

Keys overrides default key bindings.

type Modules

type Modules struct {
	Docker      bool `yaml:"docker"`
	Processes   bool `yaml:"processes"`
	Sensors     bool `yaml:"sensors"`     // temperatures, fans, battery
	Connections bool `yaml:"connections"` // live TCP table
}

Modules toggles optional feature tabs.

type Thresholds

type Thresholds struct {
	CPUWarn  float64 `yaml:"cpu_warn"`
	CPUCrit  float64 `yaml:"cpu_crit"`
	MemWarn  float64 `yaml:"mem_warn"`
	MemCrit  float64 `yaml:"mem_crit"`
	TempWarn float64 `yaml:"temp_warn"` // °C
	TempCrit float64 `yaml:"temp_crit"` // °C
}

Thresholds controls when metric values change from normal to warning to critical colors.

Jump to

Keyboard shortcuts

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