mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-10 07:42:09 -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:
@@ -13,6 +13,9 @@ Singleton {
|
||||
readonly property string configDir: Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation))
|
||||
readonly property string mangoDmsDir: configDir + "/mango/dms"
|
||||
readonly property string outputsPath: mangoDmsDir + "/outputs.conf"
|
||||
readonly property string layoutPath: mangoDmsDir + "/layout.conf"
|
||||
|
||||
property int _lastGapValue: -1
|
||||
|
||||
property bool dwlAvailable: false
|
||||
property var outputs: ({})
|
||||
@@ -29,6 +32,27 @@ Singleton {
|
||||
|
||||
signal stateChanged
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onBarConfigsChanged() {
|
||||
if (!CompositorService.isDwl)
|
||||
return;
|
||||
const newGaps = Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4));
|
||||
if (newGaps === root._lastGapValue)
|
||||
return;
|
||||
root._lastGapValue = newGaps;
|
||||
generateLayoutConfig();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: CompositorService
|
||||
function onIsDwlChanged() {
|
||||
if (CompositorService.isDwl)
|
||||
generateLayoutConfig();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: DMSService
|
||||
function onCapabilitiesReceived() {
|
||||
@@ -49,12 +73,12 @@ Singleton {
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (DMSService.dmsAvailable) {
|
||||
if (DMSService.dmsAvailable)
|
||||
checkCapabilities();
|
||||
}
|
||||
if (dwlAvailable) {
|
||||
if (dwlAvailable)
|
||||
refreshOutputScales();
|
||||
}
|
||||
if (CompositorService.isDwl)
|
||||
Qt.callLater(generateLayoutConfig);
|
||||
}
|
||||
|
||||
function checkCapabilities() {
|
||||
@@ -323,6 +347,37 @@ Singleton {
|
||||
});
|
||||
}
|
||||
|
||||
function generateLayoutConfig() {
|
||||
if (!CompositorService.isDwl)
|
||||
return;
|
||||
|
||||
const defaultRadius = typeof SettingsData !== "undefined" ? SettingsData.cornerRadius : 12;
|
||||
const defaultGaps = typeof SettingsData !== "undefined" ? Math.max(4, (SettingsData.barConfigs[0]?.spacing ?? 4)) : 4;
|
||||
const defaultBorderSize = 2;
|
||||
|
||||
const cornerRadius = (typeof SettingsData !== "undefined" && SettingsData.mangoLayoutRadiusOverride >= 0) ? SettingsData.mangoLayoutRadiusOverride : defaultRadius;
|
||||
const gaps = (typeof SettingsData !== "undefined" && SettingsData.mangoLayoutGapsOverride >= 0) ? SettingsData.mangoLayoutGapsOverride : defaultGaps;
|
||||
const borderSize = (typeof SettingsData !== "undefined" && SettingsData.mangoLayoutBorderSize >= 0) ? SettingsData.mangoLayoutBorderSize : defaultBorderSize;
|
||||
|
||||
let content = `# Auto-generated by DMS - do not edit manually
|
||||
border_radius=${cornerRadius}
|
||||
gappih=${gaps}
|
||||
gappiv=${gaps}
|
||||
gappoh=${gaps}
|
||||
gappov=${gaps}
|
||||
borderpx=${borderSize}
|
||||
`;
|
||||
|
||||
Proc.runCommand("mango-write-layout", ["sh", "-c", `mkdir -p "${mangoDmsDir}" && cat > "${layoutPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("DwlService: Failed to write layout config:", output);
|
||||
return;
|
||||
}
|
||||
console.info("DwlService: Generated layout config at", layoutPath);
|
||||
reloadConfig();
|
||||
});
|
||||
}
|
||||
|
||||
function transformToMango(transform) {
|
||||
switch (transform) {
|
||||
case "Normal":
|
||||
|
||||
Reference in New Issue
Block a user