mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-09 15:22:13 -04: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;
|
||||
|
||||
@@ -81,6 +81,13 @@ Singleton {
|
||||
property real cornerRadius: 12
|
||||
property int niriLayoutGapsOverride: -1
|
||||
property int niriLayoutRadiusOverride: -1
|
||||
property int niriLayoutBorderSize: -1
|
||||
property int hyprlandLayoutGapsOverride: -1
|
||||
property int hyprlandLayoutRadiusOverride: -1
|
||||
property int hyprlandLayoutBorderSize: -1
|
||||
property int mangoLayoutGapsOverride: -1
|
||||
property int mangoLayoutRadiusOverride: -1
|
||||
property int mangoLayoutBorderSize: -1
|
||||
|
||||
property bool use24HourClock: true
|
||||
property bool showSeconds: false
|
||||
@@ -295,6 +302,8 @@ Singleton {
|
||||
property bool runDmsMatugenTemplates: true
|
||||
property bool matugenTemplateGtk: true
|
||||
property bool matugenTemplateNiri: true
|
||||
property bool matugenTemplateHyprland: true
|
||||
property bool matugenTemplateMangowc: true
|
||||
property bool matugenTemplateQt5ct: true
|
||||
property bool matugenTemplateQt6ct: true
|
||||
property bool matugenTemplateFirefox: true
|
||||
@@ -699,10 +708,15 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function updateNiriLayout() {
|
||||
if (typeof NiriService !== "undefined" && typeof CompositorService !== "undefined" && CompositorService.isNiri) {
|
||||
function updateCompositorLayout() {
|
||||
if (typeof CompositorService === "undefined")
|
||||
return;
|
||||
if (CompositorService.isNiri && typeof NiriService !== "undefined")
|
||||
NiriService.generateNiriLayoutConfig();
|
||||
}
|
||||
if (CompositorService.isHyprland && typeof HyprlandService !== "undefined")
|
||||
HyprlandService.generateLayoutConfig();
|
||||
if (CompositorService.isDwl && typeof DwlService !== "undefined")
|
||||
DwlService.generateLayoutConfig();
|
||||
}
|
||||
|
||||
function applyStoredIconTheme() {
|
||||
@@ -778,7 +792,7 @@ Singleton {
|
||||
readonly property var _hooks: ({
|
||||
"applyStoredTheme": applyStoredTheme,
|
||||
"regenSystemThemes": regenSystemThemes,
|
||||
"updateNiriLayout": updateNiriLayout,
|
||||
"updateCompositorLayout": updateCompositorLayout,
|
||||
"applyStoredIconTheme": applyStoredIconTheme,
|
||||
"updateBarConfigs": updateBarConfigs
|
||||
})
|
||||
@@ -1459,7 +1473,7 @@ Singleton {
|
||||
|
||||
function setCornerRadius(radius) {
|
||||
set("cornerRadius", radius);
|
||||
NiriService.generateNiriLayoutConfig();
|
||||
updateCompositorLayout();
|
||||
}
|
||||
|
||||
function setWeatherLocation(displayName, coordinates) {
|
||||
@@ -1541,9 +1555,7 @@ Singleton {
|
||||
"spacing": spacing
|
||||
});
|
||||
}
|
||||
if (typeof NiriService !== "undefined" && CompositorService.isNiri) {
|
||||
NiriService.generateNiriLayoutConfig();
|
||||
}
|
||||
updateCompositorLayout();
|
||||
}
|
||||
|
||||
function setDankBarPosition(position) {
|
||||
|
||||
@@ -910,6 +910,10 @@ Singleton {
|
||||
skipTemplates.push("gtk");
|
||||
if (!SettingsData.matugenTemplateNiri)
|
||||
skipTemplates.push("niri");
|
||||
if (!SettingsData.matugenTemplateHyprland)
|
||||
skipTemplates.push("hyprland");
|
||||
if (!SettingsData.matugenTemplateMangowc)
|
||||
skipTemplates.push("mangowc");
|
||||
if (!SettingsData.matugenTemplateQt5ct)
|
||||
skipTemplates.push("qt5ct");
|
||||
if (!SettingsData.matugenTemplateQt6ct)
|
||||
|
||||
@@ -19,9 +19,16 @@ var SPEC = {
|
||||
|
||||
widgetBackgroundColor: { def: "sch" },
|
||||
widgetColorMode: { def: "default" },
|
||||
cornerRadius: { def: 12, onChange: "updateNiriLayout" },
|
||||
niriLayoutGapsOverride: { def: -1, onChange: "updateNiriLayout" },
|
||||
niriLayoutRadiusOverride: { def: -1, onChange: "updateNiriLayout" },
|
||||
cornerRadius: { def: 12, onChange: "updateCompositorLayout" },
|
||||
niriLayoutGapsOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
niriLayoutRadiusOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
niriLayoutBorderSize: { def: -1, onChange: "updateCompositorLayout" },
|
||||
hyprlandLayoutGapsOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
hyprlandLayoutRadiusOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
hyprlandLayoutBorderSize: { def: -1, onChange: "updateCompositorLayout" },
|
||||
mangoLayoutGapsOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
mangoLayoutRadiusOverride: { def: -1, onChange: "updateCompositorLayout" },
|
||||
mangoLayoutBorderSize: { def: -1, onChange: "updateCompositorLayout" },
|
||||
|
||||
use24HourClock: { def: true },
|
||||
showSeconds: { def: false },
|
||||
@@ -185,6 +192,8 @@ var SPEC = {
|
||||
runDmsMatugenTemplates: { def: true },
|
||||
matugenTemplateGtk: { def: true },
|
||||
matugenTemplateNiri: { def: true },
|
||||
matugenTemplateHyprland: { def: true },
|
||||
matugenTemplateMangowc: { def: true },
|
||||
matugenTemplateQt5ct: { def: true },
|
||||
matugenTemplateQt6ct: { def: true },
|
||||
matugenTemplateFirefox: { def: true },
|
||||
|
||||
Reference in New Issue
Block a user