// Isolated behavioral harness for SettingsBackup's live restore handoff. // Every external consumer is replaced before restore output is exercised, so // this file never writes the real compositor, wallpaper, keymap, or shell. import Quickshell import Quickshell.Io import QtQuick import qs.services ShellRoot { id: root property var calls: [] property bool homeInitialized: false property var homeFavorites: [] function record(name: string): void { const next = root.calls.slice(); next.push(name); root.calls = next; } Component.onCompleted: { SettingsBackup.readHomeState = function() { return { initialized: root.homeInitialized, favorites: root.homeFavorites }; }; SettingsBackup.resetHome = function() { root.record("home.reset"); root.homeInitialized = false; root.homeFavorites = []; }; SettingsBackup.initializeHome = function(ids) { root.record("home.initialize:" + ids.join(",")); root.homeInitialized = true; root.homeFavorites = ids.map(id => ({ id: id, alias: "" })); }; SettingsBackup.aliasHome = function(id, alias) { root.record("home.alias:" + id + "=" + alias); root.homeFavorites = root.homeFavorites.map(favorite => favorite.id === id ? { id: id, alias: alias } : favorite); }; SettingsBackup.reloadDesktop = function() { root.record("desktop.reload"); }; SettingsBackup.applyCompositor = function() { root.record("system.apply"); }; 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.reloadShell = function() { root.record("shell.reload"); }; } IpcHandler { target: "settings-backup-behavior" function reset(): void { root.calls = []; root.homeInitialized = false; root.homeFavorites = []; } function apply(output: string): bool { return SettingsBackup.handleRestoreOutput(output); } function status(): string { return JSON.stringify({ calls: root.calls, initialized: root.homeInitialized, favorites: root.homeFavorites }); } } }