mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
compositor+matugen: border override, hypr/mango layout overrides, new
templates, respect XDG paths - Add Hyprland and MangoWC templates - Add GUI gaps, window radius, and border thickness overrides for niri, Hyprland, and MangoWC - Add replacement support in matugen templates for DATA_DIR, CACHE_DIR, CONFIG_DIR fixes #1274 fixes #1273
This commit is contained in:
@@ -118,8 +118,56 @@ Singleton {
|
||||
parseSettings(greeterSessionFile.text());
|
||||
return;
|
||||
}
|
||||
parseSettings(settingsFile.text());
|
||||
_checkSessionWritable();
|
||||
|
||||
try {
|
||||
const txt = settingsFile.text();
|
||||
let obj = (txt && txt.trim()) ? JSON.parse(txt) : null;
|
||||
|
||||
if (obj?.brightnessLogarithmicDevices && !obj?.brightnessExponentialDevices)
|
||||
obj.brightnessExponentialDevices = obj.brightnessLogarithmicDevices;
|
||||
|
||||
if (obj?.nightModeStartTime !== undefined) {
|
||||
const parts = obj.nightModeStartTime.split(":");
|
||||
obj.nightModeStartHour = parseInt(parts[0]) || 18;
|
||||
obj.nightModeStartMinute = parseInt(parts[1]) || 0;
|
||||
}
|
||||
if (obj?.nightModeEndTime !== undefined) {
|
||||
const parts = obj.nightModeEndTime.split(":");
|
||||
obj.nightModeEndHour = parseInt(parts[0]) || 6;
|
||||
obj.nightModeEndMinute = parseInt(parts[1]) || 0;
|
||||
}
|
||||
|
||||
const oldVersion = obj?.configVersion ?? 0;
|
||||
if (obj && oldVersion === 0)
|
||||
migrateFromUndefinedToV1(obj);
|
||||
|
||||
if (obj && oldVersion < sessionConfigVersion) {
|
||||
const settingsDataRef = (typeof SettingsData !== "undefined") ? SettingsData : null;
|
||||
const migrated = Store.migrateToVersion(obj, sessionConfigVersion, settingsDataRef);
|
||||
if (migrated) {
|
||||
_pendingMigration = migrated;
|
||||
obj = migrated;
|
||||
}
|
||||
}
|
||||
|
||||
Store.parse(root, obj);
|
||||
|
||||
_loadedSessionSnapshot = getCurrentSessionJson();
|
||||
_hasLoaded = true;
|
||||
|
||||
if (!isGreeterMode && typeof Theme !== "undefined")
|
||||
Theme.generateSystemThemesFromCurrentTheme();
|
||||
|
||||
if (typeof WallpaperCyclingService !== "undefined")
|
||||
WallpaperCyclingService.updateCyclingState();
|
||||
|
||||
_checkSessionWritable();
|
||||
} catch (e) {
|
||||
_parseError = true;
|
||||
const msg = e.message;
|
||||
console.error("SessionData: Failed to parse session.json - file will not be overwritten. Error:", msg);
|
||||
Qt.callLater(() => ToastService.showError(I18n.tr("Failed to parse session.json"), msg));
|
||||
}
|
||||
}
|
||||
|
||||
function _checkSessionWritable() {
|
||||
@@ -158,29 +206,27 @@ Singleton {
|
||||
function parseSettings(content) {
|
||||
_parseError = false;
|
||||
try {
|
||||
let obj = (content && content.trim()) ? JSON.parse(content) : {};
|
||||
let obj = (content && content.trim()) ? JSON.parse(content) : null;
|
||||
|
||||
if (obj.brightnessLogarithmicDevices && !obj.brightnessExponentialDevices) {
|
||||
if (obj?.brightnessLogarithmicDevices && !obj?.brightnessExponentialDevices)
|
||||
obj.brightnessExponentialDevices = obj.brightnessLogarithmicDevices;
|
||||
}
|
||||
|
||||
if (obj.nightModeStartTime !== undefined) {
|
||||
if (obj?.nightModeStartTime !== undefined) {
|
||||
const parts = obj.nightModeStartTime.split(":");
|
||||
obj.nightModeStartHour = parseInt(parts[0]) || 18;
|
||||
obj.nightModeStartMinute = parseInt(parts[1]) || 0;
|
||||
}
|
||||
if (obj.nightModeEndTime !== undefined) {
|
||||
if (obj?.nightModeEndTime !== undefined) {
|
||||
const parts = obj.nightModeEndTime.split(":");
|
||||
obj.nightModeEndHour = parseInt(parts[0]) || 6;
|
||||
obj.nightModeEndMinute = parseInt(parts[1]) || 0;
|
||||
}
|
||||
|
||||
const oldVersion = obj.configVersion ?? 0;
|
||||
if (oldVersion === 0) {
|
||||
const oldVersion = obj?.configVersion ?? 0;
|
||||
if (obj && oldVersion === 0)
|
||||
migrateFromUndefinedToV1(obj);
|
||||
}
|
||||
|
||||
if (oldVersion < sessionConfigVersion) {
|
||||
if (obj && oldVersion < sessionConfigVersion) {
|
||||
const settingsDataRef = (typeof SettingsData !== "undefined") ? SettingsData : null;
|
||||
const migrated = Store.migrateToVersion(obj, sessionConfigVersion, settingsDataRef);
|
||||
if (migrated) {
|
||||
@@ -191,22 +237,14 @@ Singleton {
|
||||
|
||||
Store.parse(root, obj);
|
||||
|
||||
if (wallpaperPath && wallpaperPath.startsWith("we:")) {
|
||||
console.warn("WallpaperEngine wallpaper detected, resetting wallpaper");
|
||||
wallpaperPath = "";
|
||||
Quickshell.execDetached(["notify-send", "-u", "critical", "-a", "DMS", "-i", "dialog-warning", "WallpaperEngine Support Moved", "WallpaperEngine support has been moved to a plugin. Please enable the Linux Wallpaper Engine plugin in Settings → Plugins to continue using WallpaperEngine."]);
|
||||
}
|
||||
|
||||
_hasLoaded = true;
|
||||
_loadedSessionSnapshot = getCurrentSessionJson();
|
||||
_hasLoaded = true;
|
||||
|
||||
if (!isGreeterMode && typeof Theme !== "undefined") {
|
||||
if (!isGreeterMode && typeof Theme !== "undefined")
|
||||
Theme.generateSystemThemesFromCurrentTheme();
|
||||
}
|
||||
|
||||
if (typeof WallpaperCyclingService !== "undefined") {
|
||||
if (typeof WallpaperCyclingService !== "undefined")
|
||||
WallpaperCyclingService.updateCyclingState();
|
||||
}
|
||||
} catch (e) {
|
||||
_parseError = true;
|
||||
const msg = e.message;
|
||||
|
||||
Reference in New Issue
Block a user