diff --git a/.gitignore b/.gitignore index 5343c03a..0cf9077e 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,4 @@ bin/ # direnv .envrc .direnv/ +quickshell/dms-plugins diff --git a/quickshell/Common/SessionData.qml b/quickshell/Common/SessionData.qml index e59432e4..8b945515 100644 --- a/quickshell/Common/SessionData.qml +++ b/quickshell/Common/SessionData.qml @@ -158,12 +158,7 @@ Singleton { function parseSettings(content) { _parseError = false; try { - if (!content || !content.trim()) { - _parseError = true; - return; - } - - let obj = JSON.parse(content); + let obj = (content && content.trim()) ? JSON.parse(content) : {}; if (obj.brightnessLogarithmicDevices && !obj.brightnessExponentialDevices) { obj.brightnessExponentialDevices = obj.brightnessLogarithmicDevices; diff --git a/quickshell/Common/Theme.qml b/quickshell/Common/Theme.qml index 1fd0b0e8..3a4fd2dd 100644 --- a/quickshell/Common/Theme.qml +++ b/quickshell/Common/Theme.qml @@ -89,6 +89,8 @@ Singleton { property bool qtThemingEnabled: typeof SettingsData !== "undefined" ? (SettingsData.qt5ctAvailable || SettingsData.qt6ctAvailable) : false property var workerRunning: false property var pendingThemeRequest: null + + signal matugenCompleted(string mode, string result) property var matugenColors: ({}) property var _pendingGenerateParams: null @@ -1272,24 +1274,32 @@ Singleton { onExited: exitCode => { workerRunning = false; + const currentMode = (typeof SessionData !== "undefined" && SessionData.isLightMode) ? "light" : "dark"; - if (exitCode === 0) { + switch (exitCode) { + case 0: console.info("Theme: Matugen worker completed successfully"); - } else if (exitCode === 2) { + root.matugenCompleted(currentMode, "success"); + break; + case 2: console.log("Theme: Matugen worker completed with code 2 (no changes needed)"); - } else { + root.matugenCompleted(currentMode, "no-changes"); + break; + default: if (typeof ToastService !== "undefined") { ToastService.showError("Theme worker failed (" + exitCode + ")"); } console.warn("Theme: Matugen worker failed with exit code:", exitCode); + root.matugenCompleted(currentMode, "error"); } - if (pendingThemeRequest) { - const req = pendingThemeRequest; - pendingThemeRequest = null; - console.info("Theme: Processing queued theme request"); - setDesiredTheme(req.kind, req.value, req.isLight, req.iconTheme, req.matugenType, req.stockColors); - } + if (!pendingThemeRequest) + return; + + const req = pendingThemeRequest; + pendingThemeRequest = null; + console.info("Theme: Processing queued theme request"); + setDesiredTheme(req.kind, req.value, req.isLight, req.iconTheme, req.matugenType, req.stockColors); } }