srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/core/src
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2026-07-05 16:06:00 +0200
committersrdusr <[email protected]>2026-07-05 16:06:00 +0200
commit744757fad22db7a5ebebca9a685cdb00589a1b02 (patch)
tree1e73a425a307bae3274dad360b145560ce3e3e27 /crates/core/src
parentd448a82990efb5c510064f1de5b5d32e932a4f9e (diff)
downloadsrdwm-744757fad22db7a5ebebca9a685cdb00589a1b02.tar.gz
srdwm-744757fad22db7a5ebebca9a685cdb00589a1b02.zip
Let the config file take back a setting changed at runtime
Reported as windows still being tinted. The tint is the drop shadow, and init.lua sets general.shadows to false - loading that same config in a fresh compositor reports false, while the running session reported true. The reason it could not be corrected is a defect in the live-settings replay added earlier today. That replay re-applies every srd set after a config reload so the titlebar menu's Customize rows survive a save. The unintended half is that a live override then outranked the config file permanently: editing init.lua and saving put the override straight back, which is the state the session was found in. Live-always-wins and config-always-wins are both wrong. The rule is now that the config wins for anything it states, and a live override survives only where the config is silent. That distinction cannot come from `values`, where defaults are seeded before any script runs so every key looks set, so the config engine records which keys srd.set actually touched during the load. That record is cleared and rebuilt on each load and restored along with everything else when a reload fails. Verified both directions: a config-stated key reverts to the file's value on the next reload, and a key the config never mentions keeps its live override. 529 tests pass, clippy clean.
Diffstat (limited to 'crates/core/src')
-rw-r--r--crates/core/src/manager/lock.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/core/src/manager/lock.rs b/crates/core/src/manager/lock.rs
index ecea5fe..d24ccae 100644
--- a/crates/core/src/manager/lock.rs
+++ b/crates/core/src/manager/lock.rs
@@ -73,6 +73,15 @@ impl WindowManager {
self.live_settings.insert(key.to_string(), value_json);
}
+ /// Drops the recorded live override for `key`, so the next replay does
+ /// not reapply it. Used when a reloaded config states that key itself:
+ /// the file is then the more deliberate statement of intent, and has to
+ /// win, or a value changed at runtime could never be corrected by
+ /// editing the config again.
+ pub fn forget_live_setting(&mut self, key: &str) {
+ self.live_settings.remove(key);
+ }
+
/// Every live setting recorded so far, for replay after a config
/// reload. Cloned rather than borrowed: the replay mutates the same
/// `WindowManager` this came from.