Documentation
¶
Overview ¶
Package config carries the user-supplied YAML config that any tuilib component can consult: the starting palette and surface, block-glyph support, the double-click window. As other packages grow user-tunable knobs (logview defaults, runner clear-screen, custom keymaps, custom palettes), their fields land on Config too.
The library never writes the file and never creates the directory — config is opt-in. A missing file is the steady state for users who haven't set anything; Load returns (Config{}, nil) in that case. Parse errors on a malformed file are surfaced so silent corruption doesn't mask itself.
Cross-package usage:
cfg, _ := config.Load() start := cfg.Palette // pkg/app reads this at app.New // later, hypothetically: lvOpts := logview.FromConfig(cfg) // reads cfg.Logview
Each consumer pulls just the fields it cares about; this package owns only the file shape and I/O.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// Theme is the old name for Palette, still read when Palette is unset:
// a user's config file is outside any app's control, and a renamed key
// would silently reset their choice.
Theme string `yaml:"theme"`
// Palette names the palette to start in, for apps that choose palette
// and surface separately. Theme is read as an alias when it is unset.
Palette string `yaml:"palette"`
// Surface names the surface to start in — outlined, filled, banded,
// elevated, accented, or one the app defines. Ignored when the app
// offers only one.
Surface string `yaml:"surface"`
// BlockGlyphs says whether the terminal draws block elements (▄ ▀ ▌)
// without seams. Unset, it is assumed off for terminals known to draw
// them from the font (macOS Terminal) and on everywhere else; surfaces
// that need block glyphs fall back when it is off.
BlockGlyphs *bool `yaml:"block_glyphs"`
// DoubleClickMs is the window, in milliseconds, in which a second press
// in the same cell counts as a double click. Comfortable timing varies
// a lot between people and input devices, which is why it lives here
// rather than being fixed per app. Zero or absent leaves the app's own
// setting in force, falling back to mouse.DefaultDoubleClickInterval.
DoubleClickMs int `yaml:"double_click_ms"`
}
Config is the unmarshaled form of $XDG_CONFIG_HOME/tuilib/config.yaml. Unknown YAML keys are tolerated by yaml.Unmarshal so adding new fields is backwards-compatible.