Restore complete wallpaper policies

This commit is contained in:
Gabriel Brown
2026-08-18 15:00:18 -04:00
parent c36e423890
commit b9336d5930
4 changed files with 16 additions and 12 deletions
@@ -46,10 +46,8 @@ Singleton {
property var reloadKeybinds: function() { Keybinds.applyReload(); }
property var keybindsReloading: function() { return Keybinds.reloading; }
property var systemBusy: function() { return SystemSettings.busy; }
property var currentWallpaper: function() {
return String(DesktopPreferences.get("wallpaperPath") ?? "");
}
property var applyWallpaper: function(path) { Wallpaper.set(path); }
property var applyWallpaperPolicy: function() { Wallpaper.applyCurrentPolicy(false); }
property var wallpaperBusy: function() { return Wallpaper.busy; }
property var regenerateLock: function() { LockScreen.regenerate(); }
property var lockBusy: function() { return LockScreen.busy; }
property var reloadShell: function() { Quickshell.reload(false); }
@@ -120,7 +118,7 @@ Singleton {
// replay: compositor options, Lua-generated binds, and hyprpaper.
root.applyCompositor();
root.reloadKeybinds();
root.applyWallpaper(root.currentWallpaper());
root.applyWallpaperPolicy();
root.regenerateLock();
settleReload.attempts = 0;
@@ -138,7 +136,8 @@ Singleton {
// Let the current instances finish their external writes before a
// soft reload replaces them. The cap keeps a failed external tool
// from leaving restored Home state stale indefinitely.
if ((!root.keybindsReloading() && !root.systemBusy() && !root.lockBusy()) || attempts >= 30) {
if ((!root.keybindsReloading() && !root.systemBusy()
&& !root.wallpaperBusy() && !root.lockBusy()) || attempts >= 30) {
stop();
root.setDisplayBlocked(false);
root.protectedDisplays = ({});
@@ -61,8 +61,8 @@ ShellRoot {
SettingsBackup.reloadKeybinds = function() { root.record("keybinds.reload"); };
SettingsBackup.keybindsReloading = function() { return false; };
SettingsBackup.systemBusy = function() { return false; };
SettingsBackup.currentWallpaper = function() { return "/tmp/restored-wallpaper.jpg"; };
SettingsBackup.applyWallpaper = function(path) { root.record("wallpaper.set:" + path); };
SettingsBackup.applyWallpaperPolicy = function() { root.record("wallpaper.apply-policy"); };
SettingsBackup.wallpaperBusy = function() { return false; };
SettingsBackup.regenerateLock = function() { root.record("lock.regenerate"); };
SettingsBackup.lockBusy = function() { return false; };
SettingsBackup.reloadShell = function() { root.record("shell.reload"); };
@@ -47,7 +47,7 @@ for mapping in \
'Displays.externalChangeBlocked = blocked;' \
'SystemSettings.applyPersistedDisplayPolicy();' \
'Keybinds.applyReload();' \
'Wallpaper.set(path);' \
'Wallpaper.applyCurrentPolicy(false);' \
'LockScreen.regenerate();' \
'Quickshell.reload(false);'; do
rg -Fq "$mapping" "$service" || fail "production restore seam is missing: $mapping"
@@ -88,7 +88,7 @@ jq -e '
"display.protect:{\"DP-2\":{\"mode\":\"4500x3000@60\",\"scale\":1.5,\"transform\":0}}",
"system.apply",
"keybinds.reload",
"wallpaper.set:/tmp/restored-wallpaper.jpg",
"wallpaper.apply-policy",
"lock.regenerate",
"display.block:false",
"shell.reload"
@@ -127,7 +127,7 @@ jq -e '
"display.protect:{\"DP-2\":{\"mode\":\"4500x3000@60\",\"scale\":1.5,\"transform\":0}}",
"system.apply",
"keybinds.reload",
"wallpaper.set:/tmp/restored-wallpaper.jpg",
"wallpaper.apply-policy",
"lock.regenerate",
"display.block:false",
"shell.reload"
@@ -49,7 +49,7 @@ rg -Fq 'LockScreen.regenerate();' "$system_settings" \
|| fail 'restoreDefaults does not regenerate the shipped lock screen'
rg -Fq 'const effectivePath = path === "" ? root.shippedPath : path;' "$wallpaper_service" \
|| fail 'clearing wallpaper preference leaves the old image visible'
rg -Fq 'property string storedValue:' "$wallpaper_service" \
rg -Fq 'storedPath: rawGlobal === root.shippedPath ? "" : rawGlobal' "$wallpaper_service" \
|| fail 'the shipped wallpaper cannot remain represented by the default empty preference'
qs_for_harness() {
@@ -149,6 +149,11 @@ jq -e '.calls == [
[[ "$(qs_for_harness ipc call settings-system-test stored dockHideDelayMs)" == "250" ]] \
|| fail 'reset did not restore a schema default'
for default_case in \
'wallpaperMode|"single"' \
'wallpaperSlideshowPaths|[]' \
'wallpaperIntervalMinutes|30' \
'wallpaperShuffle|true' \
'wallpaperPerMonitor|{}' \
'lockBackgroundMode|"screenshot"' \
'lockBlurLevel|3' \
'lockShowClock|true' \