diff --git a/config/dot/quickshell/services/SettingsBackup.qml b/config/dot/quickshell/services/SettingsBackup.qml index e798831..a407c1f 100644 --- a/config/dot/quickshell/services/SettingsBackup.qml +++ b/config/dot/quickshell/services/SettingsBackup.qml @@ -46,6 +46,8 @@ Singleton { property var displayCanConfirm: function() { return Displays.canConfirm; } property var confirmDisplayLayout: function() { return Displays.confirm(); } property var setDisplayBlocked: function(blocked) { Displays.externalChangeBlocked = blocked; } + property var applyIdle: function() { IdleLock.apply(); } + property var idleBusy: function() { return IdleLock.busy; } property var applyCompositor: function() { SystemSettings.applyPersistedDisplayPolicy(); } property var reloadKeybinds: function() { Keybinds.applyReload(); } property var keybindsReloading: function() { return Keybinds.reloading; } @@ -147,10 +149,11 @@ Singleton { // DesktopPreferences.reload() invalidates reactive shell bindings. // These services also own state outside QML and need an explicit // replay: compositor options, Lua-generated binds, and hyprpaper. - root.applyCompositor(); - root.reloadKeybinds(); - root.applyWallpaperPolicy(); + root.applyIdle(); root.regenerateLock(); + root.applyWallpaperPolicy(); + root.reloadKeybinds(); + root.applyCompositor(); settleReload.attempts = 0; settleReload.restart(); @@ -167,7 +170,7 @@ 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() + if ((!root.idleBusy() && !root.keybindsReloading() && !root.systemBusy() && !root.wallpaperBusy() && !root.lockBusy()) || attempts >= 30) { stop(); root.setDisplayBlocked(false); diff --git a/config/dot/quickshell/settings-backup-harness.qml b/config/dot/quickshell/settings-backup-harness.qml index 73c404b..c246001 100644 --- a/config/dot/quickshell/settings-backup-harness.qml +++ b/config/dot/quickshell/settings-backup-harness.qml @@ -93,6 +93,8 @@ ShellRoot { root.record("display.block:" + blocked); root.displayBlocked = blocked; }; + SettingsBackup.applyIdle = function() { root.record("idle.apply"); }; + SettingsBackup.idleBusy = function() { return false; }; SettingsBackup.applyCompositor = function() { root.record("system.apply"); }; SettingsBackup.reloadKeybinds = function() { root.record("keybinds.reload"); }; SettingsBackup.keybindsReloading = function() { return false; }; diff --git a/tests/quickshell/settings-backup-live-contract.sh b/tests/quickshell/settings-backup-live-contract.sh index 39526f2..ba1af7f 100755 --- a/tests/quickshell/settings-backup-live-contract.sh +++ b/tests/quickshell/settings-backup-live-contract.sh @@ -48,6 +48,7 @@ for mapping in \ 'Displays.applyProtectedLayout(layout);' \ 'Displays.canConfirm;' \ 'Displays.confirm();' \ + 'IdleLock.apply();' \ 'Displays.externalChangeBlocked = blocked;' \ 'SystemSettings.applyPersistedDisplayPolicy();' \ 'Keybinds.applyReload();' \ @@ -91,10 +92,11 @@ jq -e ' "desktop.reload", "display.apply:[{\"name\":\"DP-2\",\"width\":4500,\"height\":3000,\"refreshRate\":60,\"mode\":\"4500x3000@60\",\"scale\":1.5,\"transform\":0,\"x\":-2560,\"y\":0,\"primary\":false},{\"name\":\"HDMI-A-1\",\"width\":2560,\"height\":1440,\"refreshRate\":60,\"mode\":\"2560x1440@60\",\"scale\":1,\"transform\":0,\"x\":0,\"y\":0,\"primary\":true}]", "display.confirm", - "system.apply", - "keybinds.reload", - "wallpaper.apply-policy", + "idle.apply", "lock.regenerate", + "wallpaper.apply-policy", + "keybinds.reload", + "system.apply", "display.block:false", "shell.reload" ] @@ -131,10 +133,11 @@ jq -e ' "desktop.reload", "display.apply:[{\"name\":\"DP-2\",\"width\":4500,\"height\":3000,\"refreshRate\":60,\"mode\":\"4500x3000@60\",\"scale\":1.5,\"transform\":0,\"x\":-2560,\"y\":0,\"primary\":false},{\"name\":\"HDMI-A-1\",\"width\":2560,\"height\":1440,\"refreshRate\":60,\"mode\":\"2560x1440@60\",\"scale\":1,\"transform\":0,\"x\":0,\"y\":0,\"primary\":true}]", "display.confirm", - "system.apply", - "keybinds.reload", - "wallpaper.apply-policy", + "idle.apply", "lock.regenerate", + "wallpaper.apply-policy", + "keybinds.reload", + "system.apply", "display.block:false", "shell.reload" ]