Add desktop widgets and streamline documentation

This commit is contained in:
Samuel Onoja committed 2026-09-26 22:53:51 +01:00
1 parent c63af64d87
commit 8dc895448d
25 files changed
+2724 -3686

No files matched your search

+25
View File
@@ -16,6 +16,8 @@ use crate::window_rules::{self, WindowRule, WindowRuleConfig};
#[derive(Debug, Default, Deserialize)]
pub struct Config {
#[serde(default)]
desktop_widgets: ferese_core::desktop::DesktopWidgets,
#[serde(default)]
pub(crate) autostart: Vec<DaemonConfig>,
#[serde(default)]
@@ -270,6 +272,9 @@ impl Config {
}
pub(crate) fn runtime_config(&self) -> Result<crate::RuntimeConfig, ConfigError> {
self.desktop_widgets
.validate()
.map_err(ConfigError::InvalidBinding)?;
for daemon in &self.autostart {
if daemon
.command
@@ -1712,6 +1717,26 @@ pub(crate) fn config_path() -> Option<PathBuf> {
mod tests {
use super::*;
#[test]
fn desktop_clock_settings_are_validated_before_live_publication() {
assert!(
parse(
"[desktop_widgets.clock]\nenabled = true\nanchor = 'center'\ntime_format = '%H:%M'"
)
.runtime_config()
.is_ok()
);
for source in [
"[desktop_widgets.clock]\nwidth = 8192",
"[desktop_widgets.clock]\nopacity = nan",
"[desktop_widgets.clock]\ntime_format = '%'",
"[desktop_widgets.clock]\ntime_zone = 'invalid/zone'",
] {
assert!(parse(source).runtime_config().is_err());
}
assert!(Config::parse_source("[desktop_widgets.clock]\nanchor = 'wrong'").is_err());
}
fn parse(source: &str) -> Config {
toml::from_str(source).unwrap()
}