Make Panama settings one shared source of truth
Panama had grown into three configuration surfaces that only agreed because they had been typed to agree: looks.lua hardcoded values, DesktopPreferences independently defaulted the same values, and SystemSettings replayed them at startup. Nothing kept them in sync, and the Lua side read no shared state at all. This lands the first three stages of docs/superpowers/plans/2026-08-17-panama-cohesion.md. Fix silently failing Hyprland writes. On a Lua-configured Hyprland, hyprctl keyword refuses the write, prints the refusal to stdout, and still exits 0, so the HDR, VRR, and direct-scanout toggles persisted their value and reported success while the compositor never changed. Writes now go through hyprctl eval, which has the same hazard on syntax and runtime errors, so success is defined as reading the value back and finding it equal. The existing contract passed throughout the outage because it re-applied the values already in place; the new one flips each value to something it does not hold. Derive preferences from a schema. Every setting used to be restated four times -- a property alias, a JSON adapter property, a change handler, and a line in reset -- where omitting any one failed silently. PreferenceSchema.qml is now the single source, and persistence, validation, reset, and the Hyprland mapping all derive from it. Unknown keys on disk survive a write so a rollback does not discard a newer build's settings, and a corrupt file falls back to shipped defaults. The store moved to ~/.config/panama/settings.json, migrating from the old state directory without deleting it. Share that file with Hyprland. prefs.lua reads it at config time with every shipped literal kept as the fallback, so the config still stands alone. The Lua is the default, the JSON is the truth, and Settings is the editor. The compositor-adjustable surface goes from 3 keys to 23. Also fixes two test-hygiene bugs found by running the suite end to end for the first time: settings-pages-contract could see the window settings-window-contract leaves behind, and the new write contract was persisting its deliberately-wrong values into the user's real store. Claude-Session: https://claude.ai/code/session_01BRvzt4H8XXLPVH5MyYdk9L
This commit is contained in:
+19
-17
@@ -12,12 +12,14 @@
|
||||
-- display.
|
||||
-- ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
local prefs = require("prefs")
|
||||
|
||||
hl.config({
|
||||
general = {
|
||||
gaps_in = 5,
|
||||
gaps_out = 10,
|
||||
gaps_in = prefs.get("gapsIn", 5),
|
||||
gaps_out = prefs.get("gapsOut", 10),
|
||||
|
||||
border_size = 2,
|
||||
border_size = prefs.get("borderSize", 2),
|
||||
|
||||
col = {
|
||||
-- The prism: blue leads, orchid follows, on a diagonal so the pair
|
||||
@@ -44,16 +46,16 @@ hl.config({
|
||||
decoration = {
|
||||
-- 18 to match the shell's popover radius, so a window and a panel sitting
|
||||
-- next to each other read as the same object family.
|
||||
rounding = 18,
|
||||
rounding = prefs.get("windowRounding", 18),
|
||||
rounding_power = 2,
|
||||
|
||||
active_opacity = 1.0,
|
||||
inactive_opacity = 1.0,
|
||||
inactive_opacity = prefs.get("inactiveOpacity", 1.0),
|
||||
|
||||
blur = {
|
||||
enabled = true,
|
||||
size = 8,
|
||||
passes = 3,
|
||||
enabled = prefs.get("blurEnabled", true),
|
||||
size = prefs.get("blurSize", 8),
|
||||
passes = prefs.get("blurPasses", 3),
|
||||
|
||||
-- Required for blur to be affordable. Never turn this off.
|
||||
new_optimizations = true,
|
||||
@@ -75,8 +77,8 @@ hl.config({
|
||||
},
|
||||
|
||||
shadow = {
|
||||
enabled = true,
|
||||
range = 20,
|
||||
enabled = prefs.get("shadowEnabled", true),
|
||||
range = prefs.get("shadowRange", 20),
|
||||
render_power = 3,
|
||||
sharp = false,
|
||||
color = "rgba(15161eee)",
|
||||
@@ -88,8 +90,8 @@ hl.config({
|
||||
-- border is the signature, and a strong halo would compete with it.
|
||||
-- This is just enough to lift the focused window off the wallpaper.
|
||||
glow = {
|
||||
enabled = true,
|
||||
range = 8,
|
||||
enabled = prefs.get("glowEnabled", true),
|
||||
range = prefs.get("glowRange", 8),
|
||||
render_power = 2,
|
||||
color = "rgba(82aaff33)",
|
||||
color_inactive = "rgba(00000000)",
|
||||
@@ -99,7 +101,7 @@ hl.config({
|
||||
motion_blur = { enabled = false },
|
||||
},
|
||||
|
||||
animations = { enabled = true },
|
||||
animations = { enabled = prefs.get("animationsEnabled", true) },
|
||||
|
||||
dwindle = {
|
||||
-- Keep the split orientation a window was created with. Closest match
|
||||
@@ -118,7 +120,7 @@ hl.config({
|
||||
-- Variable refresh rate. 3 = enable only for fullscreen windows whose
|
||||
-- content type is "video" or "game" -- the tag rules.lua applies to
|
||||
-- games. Keeps VRR off the desktop, where it causes visible flicker.
|
||||
vrr = 3,
|
||||
vrr = prefs.getInt("vrrPolicy", 3),
|
||||
|
||||
-- Blur behind the lock screen.
|
||||
session_lock_blur = true,
|
||||
@@ -137,12 +139,12 @@ hl.config({
|
||||
-- 1 = automatically flip the monitor into HDR for fullscreen content
|
||||
-- that asks for it, and back out afterwards. This is how games get HDR
|
||||
-- without the desktop paying the screencopy cost. See monitors.lua.
|
||||
cm_auto_hdr = 1,
|
||||
cm_auto_hdr = prefs.getInt("autoHdr", 1),
|
||||
|
||||
-- 2 = direct scanout only for windows tagged content = "game"
|
||||
-- (set by the rules in rules.lua). Bypasses compositing for real
|
||||
-- fullscreen games.
|
||||
direct_scanout = 2,
|
||||
direct_scanout = prefs.getInt("directScanoutPolicy", 2),
|
||||
},
|
||||
|
||||
cursor = {
|
||||
@@ -158,7 +160,7 @@ hl.config({
|
||||
sync_gsettings_theme = true,
|
||||
|
||||
-- Fade the cursor out after 4s of no movement, like GNOME does.
|
||||
inactive_timeout = 4,
|
||||
inactive_timeout = prefs.get("cursorInactiveTimeout", 4),
|
||||
},
|
||||
|
||||
ecosystem = {
|
||||
|
||||
Reference in New Issue
Block a user