mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
session: fix persist on empty file
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -108,3 +108,4 @@ bin/
|
||||
# direnv
|
||||
.envrc
|
||||
.direnv/
|
||||
quickshell/dms-plugins
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,26 +1274,34 @@ 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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: customThemeFileView
|
||||
|
||||
Reference in New Issue
Block a user