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