import Quickshell import Quickshell.Io import QtQuick import qs.config import qs.services ShellRoot { IpcHandler { target: "settings-system-test" function refresh(): void { SystemSettings.refresh(); } // One batch, matching how the shell applies persisted policy. Three // separate setters would be refused as overlapping writes, since each // one is only complete after its value has been read back. function apply(autoHdr: bool, vrr: int, directScanout: int): void { SystemSettings.applyOptions({ autoHdr: autoHdr, vrrPolicy: vrr, directScanoutPolicy: directScanout }); } // Applies an arbitrary batch of schema keys, so the contract can cover // every getoption answer shape -- int, bool, float, str, and the css // box that gaps read back as -- not just the display policies. function applyJson(payload: string): bool { return SystemSettings.applyOptions(JSON.parse(payload)); } // The routing entry point the settings rows use: a compositor-backed // key must be applied and verified before it is stored, a local one is // written directly. The contract checks both halves. function commit(key: string, payload: string): bool { return SystemSettings.commitPreference(key, JSON.parse(payload)); } function stored(key: string): string { return JSON.stringify(DesktopPreferences.get(key)); } function seedHome(): void { HomePreferences.favorites = [{ id: "light.contract_probe", alias: "Probe" }]; HomePreferences.initialized = true; } function homeState(): string { return JSON.stringify({ count: HomePreferences.favorites.length, initialized: HomePreferences.initialized }); } function restoreDefaults(): void { SystemSettings.restoreDefaults(); } function panelAllowed(panel: string): bool { return SystemSettings.isGnomePanelAllowed(panel); } function status(): string { return JSON.stringify({ monitorName: SystemSettings.monitorName, monitorDescription: SystemSettings.monitorDescription, width: SystemSettings.monitorWidth, height: SystemSettings.monitorHeight, scale: SystemSettings.monitorScale, format: SystemSettings.monitorFormat, busy: SystemSettings.busy, lastError: SystemSettings.lastError }); } } }