1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

session: fix persist on empty file

This commit is contained in:
bbedward
2026-01-05 09:07:00 -05:00
parent c1d95a3086
commit 0236fe3276
3 changed files with 21 additions and 15 deletions

1
.gitignore vendored
View File

@@ -108,3 +108,4 @@ bin/
# direnv
.envrc
.direnv/
quickshell/dms-plugins

View File

@@ -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;

View File

@@ -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);
}
}