Settings/State: Moved state IPC logic to ShellState.qml.

This commit is contained in:
ItsLemmy
2025-11-29 11:04:44 -05:00
parent 9d4ac03d21
commit 993b6bc422
3 changed files with 57 additions and 55 deletions
+29
View File
@@ -3,6 +3,10 @@ pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
import "../Helpers/QtObj2JS.js" as QtObj2JS
import qs.Services.Power
import qs.Services.System
import qs.Services.UI
// Centralized shell state management for small cache files
Singleton {
@@ -179,4 +183,29 @@ Singleton {
function getWallpapers() {
return adapter.wallpapers || {};
}
// -----------------------------------------------------
function buildStateSnapshot() {
try {
const settingsData = QtObj2JS.qtObjectToPlainObject(Settings.data);
const shellStateData = ShellState?.data ? QtObj2JS.qtObjectToPlainObject(ShellState.data) || {} : {};
return {
settings: settingsData,
state: {
doNotDisturb: NotificationService.doNotDisturb,
noctaliaPerformanceMode: PowerProfileService.noctaliaPerformanceMode,
barVisible: BarService.isVisible,
display: shellStateData.display || {},
wallpapers: shellStateData.wallpapers || {},
notificationsState: shellStateData.notificationsState || {},
changelogState: shellStateData.changelogState || {},
colorSchemesList: shellStateData.colorSchemesList || {}
}
};
} catch (error) {
Logger.e("Settings", "Failed to build state snapshot:", error);
return null;
}
}
}