Documentation
¶
Overview ¶
Package preset defines the Preset data model and built-in presets. A preset bundles visual configuration only: widget layout, separator, render mode, theme, icon set, and directory style. It does not include data-source settings such as thresholds, git options, or speed windows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPreset ¶
ApplyPreset overlays a preset's visual settings onto cfg. It replaces Lines and sets Style.Separator, Icons, Mode, Theme, and Directory.Style from the preset, then calls config.ResolveTheme so the updated palette is ready for rendering.
User-preference fields are never touched: Thresholds, Context, Git, Speed, and Theme.Overrides remain exactly as the user configured them.
func BuiltinNames ¶
func BuiltinNames() []string
BuiltinNames returns the names of all built-in presets in sorted order.
func CustomPresetDir ¶
func CustomPresetDir() string
CustomPresetDir returns the directory where custom preset TOML files are stored: ~/.config/vitals/presets/.
func ListAll ¶
func ListAll() []string
ListAll returns built-in preset names followed by custom preset names. Both halves are sorted. Duplicates are removed (built-in takes precedence).
func ListCustom ¶
func ListCustom() []string
ListCustom returns the sorted names of all .toml files in CustomPresetDir, without the .toml extension. If the directory does not exist, it returns an empty slice rather than an error.
func LoadHudWithPreset ¶
LoadHudWithPreset loads the default config via config.LoadHud and then applies the named preset. If presetName is empty, or if no preset with that name exists in the built-in registry, the unmodified config is returned. This function never returns nil.
Types ¶
type Preset ¶
type Preset struct {
Name string
Lines []config.Line
Separator string
Icons string
Mode string // plain, powerline, minimal
Theme string
DirectoryStyle string
}
Preset holds the visual configuration for a named layout.
func Load ¶
Load returns the named built-in preset. Returns a zero-value Preset and false when name is not a known built-in.
func LoadCustom ¶
LoadCustom loads a preset by name from the CustomPresetDir. It looks for name.toml in that directory and delegates to LoadFromFile.
func LoadFromFile ¶
LoadFromFile parses a TOML preset file at path and returns a Preset. The preset Name defaults to the file's base name (without extension) when the TOML does not set a name field.