Tier 0: render what the services already decided, honestly

Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
Gabriel Brown
2026-08-25 00:24:30 -04:00
parent be0e55214b
commit 8b1205e4b8
38 changed files with 1474 additions and 260 deletions
@@ -51,7 +51,12 @@ Singleton {
// singleton and a mutual reference between two singletons is an
// initialisation-order problem waiting to happen. Tests override it the
// same way they override the seams above.
property var takeSafetySnapshot: function() { return false; }
//
// Contract: takeSafetySnapshot(done) returns false when the snapshot could
// not even be STARTED, and otherwise calls done(success) once the helper
// has finished. It is asynchronous, so the return value says nothing about
// whether anything is on disk yet.
property var takeSafetySnapshot: function(done) { return false; }
property var setDisplayBlocked: function(blocked) { Displays.externalChangeBlocked = blocked; }
property var reloadKeybinds: function() { Keybinds.applyReload(); }
property var keybindsReloading: function() { return Keybinds.reloading; }
@@ -532,6 +537,12 @@ Singleton {
return DesktopPreferences.set(key, value);
}
// True from the moment a reset asks for its safety snapshot until that
// snapshot answers. The UI has no undo, so a second request in that window
// is refused rather than allowed to race the first one's wipe, and the page
// keeps the confirmation on screen for as long as it is true.
property bool resetPending: false
// Restores shipped defaults across every store Panama owns, not just the
// schema. Panama keeps user state in more than one file -- the schema store,
// the focus session, and the Home accessory arrangement -- and a reset that
@@ -539,23 +550,50 @@ Singleton {
//
// Compositor-backed values are re-applied afterwards, since resetting the
// stored value does not by itself tell Hyprland anything.
//
// Returns whether the reset was STARTED. The wipe itself happens later, in
// the snapshot's success path -- see performReset below.
function restoreDefaults(): bool {
if (root.displayBusy()) {
root.lastError = "Finish the current display change before restoring defaults.";
return false;
}
if (root.resetPending) {
root.lastError = "A reset is already under way.";
return false;
}
// Snapshot before wiping. Restoring defaults clears every preference
// and the Home accessory store, and there is no undo for it anywhere in
// the app -- so the one automatic snapshot Panama takes is the one taken
// immediately before the only irreversible action it offers.
//
// Deliberately not fatal if it fails: a user who asked to reset should
// get their reset, and a snapshot that could not be written is reported
// rather than allowed to block the thing they asked for.
if (!root.takeSafetySnapshot())
console.warn("SystemSettings: could not snapshot before restoring defaults");
// The snapshot is a separate process reading settings.json. Wiping the
// stores here, as this used to, meant the file was already back to
// shipped defaults by the time the helper opened it: the "undoable"
// promise in the confirm recorded the RESET state, not the user's. So
// the reset now lives entirely inside the completion path, and a
// snapshot that fails takes the reset down with it -- the alternative is
// an irreversible action offered as a reversible one.
root.resetPending = true;
const started = root.takeSafetySnapshot(function(success) {
root.resetPending = false;
if (!success) {
root.lastError = "Your settings could not be backed up, so nothing was reset.";
return;
}
root.lastError = "";
root.performReset();
});
if (!started) {
root.resetPending = false;
root.lastError = "Your settings could not be backed up, so nothing was reset.";
return false;
}
return true;
}
function performReset(): void {
root.setDisplayBlocked(true);
DesktopPreferences.resetDesktopDefaults();
@@ -573,7 +611,6 @@ Singleton {
HomePreferences.resetHomeDefaults();
resettleTimer.restart();
return true;
}
Timer {