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

core: add resolve-include recursive

fixes #1294
This commit is contained in:
bbedward
2026-01-07 16:45:31 -05:00
parent db1de9df38
commit 5dc7c0d797
4 changed files with 362 additions and 16 deletions

View File

@@ -401,8 +401,8 @@ Singleton {
}
function checkIncludeStatus() {
const paths = getConfigPaths();
if (!paths) {
const compositor = CompositorService.compositor;
if (compositor !== "niri" && compositor !== "hyprland" && compositor !== "dwl") {
includeStatus = {
"exists": false,
"included": false
@@ -410,14 +410,27 @@ Singleton {
return;
}
const filename = (compositor === "niri") ? "outputs.kdl" : "outputs.conf";
const compositorArg = (compositor === "dwl") ? "mangowc" : compositor;
checkingInclude = true;
Proc.runCommand("check-outputs-include", ["sh", "-c", `exists=false; included=false; ` + `[ -f "${paths.outputsFile}" ] && exists=true; ` + `[ -f "${paths.configFile}" ] && grep -v '^[[:space:]]*\\(//\\|#\\)' "${paths.configFile}" | grep -q '${paths.grepPattern}' && included=true; ` + `echo "$exists $included"`], (output, exitCode) => {
Proc.runCommand("check-outputs-include", ["dms", "config", "resolve-include", compositorArg, filename], (output, exitCode) => {
checkingInclude = false;
const parts = output.trim().split(" ");
includeStatus = {
"exists": parts[0] === "true",
"included": parts[1] === "true"
};
if (exitCode !== 0) {
includeStatus = {
"exists": false,
"included": false
};
return;
}
try {
includeStatus = JSON.parse(output.trim());
} catch (e) {
includeStatus = {
"exists": false,
"included": false
};
}
});
}

View File

@@ -55,22 +55,36 @@ Item {
}
function checkCursorIncludeStatus() {
const paths = getCursorConfigPaths();
if (!paths) {
const compositor = CompositorService.compositor;
if (compositor !== "niri" && compositor !== "hyprland" && compositor !== "dwl") {
cursorIncludeStatus = {
"exists": false,
"included": false
};
return;
}
const filename = (compositor === "niri") ? "cursor.kdl" : "cursor.conf";
const compositorArg = (compositor === "dwl") ? "mangowc" : compositor;
checkingCursorInclude = true;
Proc.runCommand("check-cursor-include", ["sh", "-c", `exists=false; included=false; ` + `[ -f "${paths.cursorFile}" ] && exists=true; ` + `[ -f "${paths.configFile}" ] && grep -v '^[[:space:]]*\\(//\\|#\\)' "${paths.configFile}" | grep -q '${paths.grepPattern}' && included=true; ` + `echo "$exists $included"`], (output, exitCode) => {
Proc.runCommand("check-cursor-include", ["dms", "config", "resolve-include", compositorArg, filename], (output, exitCode) => {
checkingCursorInclude = false;
const parts = output.trim().split(" ");
cursorIncludeStatus = {
"exists": parts[0] === "true",
"included": parts[1] === "true"
};
if (exitCode !== 0) {
cursorIncludeStatus = {
"exists": false,
"included": false
};
return;
}
try {
cursorIncludeStatus = JSON.parse(output.trim());
} catch (e) {
cursorIncludeStatus = {
"exists": false,
"included": false
};
}
});
}