From 4e72d2ce982ba1e49f767d342cad7ef7c6423c04 Mon Sep 17 00:00:00 2001 From: Niklas Herder Date: Sat, 12 Sep 2026 09:03:34 +0200 Subject: [PATCH] config: migrate cursor_hide_timeout to the grouped cursor_hide key Reads the legacy key once at startup when the new one is absent, so the handful of people who set it by hand from the cosmic-settings#603 thread do not silently lose auto-hide. The old file is left on disk so a downgrade still finds it. Drafted with Claude (Anthropic); reviewed and tested by the committer. --- src/config/mod.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/config/mod.rs b/src/config/mod.rs index 714dd29b..24c579bc 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -10,7 +10,7 @@ use crate::{ }, }; use anyhow::Context; -use cosmic_config::{ConfigGet, CosmicConfigEntry}; +use cosmic_config::{ConfigGet, ConfigSet, CosmicConfigEntry}; use cosmic_settings_config::window_rules::ApplicationException; use cosmic_settings_config::{Shortcuts, shortcuts, window_rules}; use serde::{Deserialize, Serialize}; @@ -182,7 +182,7 @@ impl Config { .expect("Failed to add cosmic-config to the event loop"); let xdg = xdg::BaseDirectories::new(); - let cosmic_comp_config = + let mut cosmic_comp_config = CosmicCompConfig::get_entry(&config).unwrap_or_else(|(errs, c)| { if cfg!(debug_assertions) { for err in errs { @@ -192,6 +192,18 @@ impl Config { c }); + // `cursor_hide_timeout` was replaced by the grouped `cursor_hide` key. + // Seed the new key once so configs hand-edited before the rename keep + // working; the old file is left in place so a downgrade still reads it. + if config.get::("cursor_hide").is_err() + && let Ok(legacy) = config.get::>("cursor_hide_timeout") + { + cosmic_comp_config.cursor_hide.idle_timeout = legacy; + if let Err(err) = config.set("cursor_hide", cosmic_comp_config.cursor_hide) { + warn!(?err, "Failed to migrate cursor_hide_timeout to cursor_hide"); + } + } + // Listen for updates to the toolkit config if let Ok(tk_config) = cosmic_config::Config::new("com.system76.CosmicTk", 1) { fn handle_new_toolkit_config(config: CosmicTk, state: &mut State) {