pub struct Config {
pub sensors: SensorConfig,
pub smart: SmartConfig,
pub btrfs: BtrfsConfig,
pub lhm: LhmConfig,
pub overview: OverviewConfig,
pub alerts: AlertsConfig,
pub notifications: NotificationsConfig,
pub hosts: Vec<HostConfig>,
pub widgets: Vec<WidgetConfig>,
}Expand description
Top-level configuration.
Fields§
§sensors: SensorConfigSensor naming and visibility.
smart: SmartConfigSMART result files.
btrfs: BtrfsConfigbtrfs scrub status files.
lhm: LhmConfigLibreHardwareMonitor’s web server, the source of temperatures, fans and CPU power on Windows.
overview: OverviewConfigThe multi-host overview.
alerts: AlertsConfigWhen a reading becomes an alert.
notifications: NotificationsConfigDesktop notifications for new alerts (GUI).
hosts: Vec<HostConfig>Remote hosts monitored over SSH ([[hosts]] tables).
widgets: Vec<WidgetConfig>Extra panels beside the monitor ([[widgets]] tables).
Implementations§
Source§impl Config
impl Config
Sourcepub fn default_path() -> Option<PathBuf>
pub fn default_path() -> Option<PathBuf>
Default path of the configuration file, if the platform has a config directory.
Sourcepub fn load(path: &Path) -> Result<Self, ConfigError>
pub fn load(path: &Path) -> Result<Self, ConfigError>
Loads the configuration from path. A missing file yields the defaults.
Sourcepub fn load_default() -> Result<Self, ConfigError>
pub fn load_default() -> Result<Self, ConfigError>
Loads from Config::default_path, or returns the defaults when the
platform has no config directory.
Sourcepub fn save(&self, path: &Path) -> Result<(), ConfigError>
pub fn save(&self, path: &Path) -> Result<(), ConfigError>
Writes the configuration to path, creating parent directories.
The file is written to a temporary sibling and renamed into place, so a crash never leaves a truncated config behind.
Sourcepub fn save_hosts(path: &Path, hosts: &[HostConfig]) -> Result<(), ConfigError>
pub fn save_hosts(path: &Path, hosts: &[HostConfig]) -> Result<(), ConfigError>
Replaces the [[hosts]] of the configuration file at path with
hosts, keeping everything else in the file (other settings,
comments, formatting) untouched. Creates the file if needed.
Used by the GUI’s host editor. The edited file is checked to load as a valid configuration before it replaces the old one.
Sourcepub fn save_sensors(
path: &Path,
sensors: &SensorConfig,
) -> Result<(), ConfigError>
pub fn save_sensors( path: &Path, sensors: &SensorConfig, ) -> Result<(), ConfigError>
Replaces the sensor names and hidden sensors ([sensors]) of the
configuration file at path, keeping the rest of the file as it is,
like Config::save_hosts. Names stay an inline table if they were
one.
Used by the GUI’s sensor editor.
Sourcepub fn fan_label<'a>(&'a self, fan: &'a Fan) -> &'a str
pub fn fan_label<'a>(&'a self, fan: &'a Fan) -> &'a str
Display name of a fan: the user-defined label, or the driver/generic label.
Sourcepub fn temperature_label<'a>(&'a self, temperature: &'a Temperature) -> &'a str
pub fn temperature_label<'a>(&'a self, temperature: &'a Temperature) -> &'a str
Display name of a temperature channel.
Sourcepub fn label_for(&self, key: &str) -> Option<&str>
pub fn label_for(&self, key: &str) -> Option<&str>
User-defined label for a channel key, if any.
Sourcepub fn set_label(&mut self, key: &str, name: &str)
pub fn set_label(&mut self, key: &str, name: &str)
Sets (or, with an empty name, removes) the label of a channel.
Whether the user chose to hide a channel.