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

cursor: hypr, mango, and dankinstall support for configs

This commit is contained in:
bbedward
2026-01-06 20:35:22 -05:00
parent 721700190b
commit ad43053b94
24 changed files with 2741 additions and 709 deletions

View File

@@ -179,6 +179,16 @@ Singleton {
}
}
Process {
id: ensureCursorProcess
property string cursorPath: ""
onExited: exitCode => {
if (exitCode !== 0)
console.warn("NiriService: Failed to ensure cursor.kdl, exit code:", exitCode);
}
}
DankSocket {
id: eventStreamSocket
path: root.socketPath
@@ -1088,6 +1098,11 @@ Singleton {
ensureBindsProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && [ ! -f "${bindsPath}" ] && touch "${bindsPath}" || true`];
ensureBindsProcess.running = true;
const cursorPath = niriDmsDir + "/cursor.kdl";
ensureCursorProcess.cursorPath = cursorPath;
ensureCursorProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && [ ! -f "${cursorPath}" ] && touch "${cursorPath}" || true`];
ensureCursorProcess.running = true;
configGenerationPending = false;
}
@@ -1110,16 +1125,33 @@ Singleton {
console.log("NiriService: Generating cursor config...");
const settings = typeof SettingsData !== "undefined" ? SettingsData.cursorSettings : {
theme: "System Default",
size: 24,
niri: {}
};
const configDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation));
const niriDmsDir = configDir + "/niri/dms";
const cursorPath = niriDmsDir + "/cursor.kdl";
const settings = typeof SettingsData !== "undefined" ? SettingsData.cursorSettings : null;
if (!settings) {
writeCursorProcess.cursorContent = "";
writeCursorProcess.cursorPath = cursorPath;
writeCursorProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && : > "${cursorPath}"`];
writeCursorProcess.running = true;
return;
}
const themeName = settings.theme === "System Default" ? (SettingsData.systemDefaultCursorTheme || "") : settings.theme;
const size = settings.size || 24;
const hideWhenTyping = settings.niri?.hideWhenTyping || false;
const hideAfterMs = settings.niri?.hideAfterInactiveMs || 0;
const isDefaultConfig = !themeName && size === 24 && !hideWhenTyping && hideAfterMs === 0;
if (isDefaultConfig) {
writeCursorProcess.cursorContent = "";
writeCursorProcess.cursorPath = cursorPath;
writeCursorProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && : > "${cursorPath}"`];
writeCursorProcess.running = true;
return;
}
const dmsWarning = `// ! DO NOT EDIT !
// ! AUTO-GENERATED BY DMS !
// ! CHANGES WILL BE OVERWRITTEN !
@@ -1129,25 +1161,19 @@ Singleton {
let cursorContent = dmsWarning + `cursor {\n`;
if (themeName) {
if (themeName)
cursorContent += ` xcursor-theme "${themeName}"\n`;
}
cursorContent += ` xcursor-size ${size}\n`;
if (hideWhenTyping) {
if (hideWhenTyping)
cursorContent += ` hide-when-typing\n`;
}
if (hideAfterMs > 0) {
if (hideAfterMs > 0)
cursorContent += ` hide-after-inactive-ms ${hideAfterMs}\n`;
}
cursorContent += `}`;
const configDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.ConfigLocation));
const niriDmsDir = configDir + "/niri/dms";
const cursorPath = niriDmsDir + "/cursor.kdl";
writeCursorProcess.cursorContent = cursorContent;
writeCursorProcess.cursorPath = cursorPath;