mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-14 01:32:29 -04:00
cursor: hypr, mango, and dankinstall support for configs
This commit is contained in:
@@ -13,6 +13,7 @@ Singleton {
|
||||
readonly property string hyprDmsDir: configDir + "/hypr/dms"
|
||||
readonly property string outputsPath: hyprDmsDir + "/outputs.conf"
|
||||
readonly property string layoutPath: hyprDmsDir + "/layout.conf"
|
||||
readonly property string cursorPath: hyprDmsDir + "/cursor.conf"
|
||||
|
||||
property int _lastGapValue: -1
|
||||
|
||||
@@ -241,4 +242,65 @@ decoration {
|
||||
return "Normal";
|
||||
}
|
||||
}
|
||||
|
||||
function generateCursorConfig() {
|
||||
if (!CompositorService.isHyprland)
|
||||
return;
|
||||
|
||||
console.log("HyprlandService: Generating cursor config...");
|
||||
|
||||
const settings = typeof SettingsData !== "undefined" ? SettingsData.cursorSettings : null;
|
||||
if (!settings) {
|
||||
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.warn("HyprlandService: Failed to write cursor config:", output);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const themeName = settings.theme === "System Default" ? (SettingsData.systemDefaultCursorTheme || "") : settings.theme;
|
||||
const size = settings.size || 24;
|
||||
const hideWhenTyping = settings.hyprland?.hideWhenTyping || false;
|
||||
const hideOnTouch = settings.hyprland?.hideOnTouch || false;
|
||||
const hideOnKeyPress = settings.hyprland?.hideOnKeyPress || false;
|
||||
const inactiveTimeout = settings.hyprland?.inactiveTimeout || 0;
|
||||
|
||||
const isDefaultConfig = !themeName && size === 24 && !hideWhenTyping && !hideOnTouch && !hideOnKeyPress && inactiveTimeout === 0;
|
||||
if (isDefaultConfig) {
|
||||
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
console.warn("HyprlandService: Failed to write cursor config:", output);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let content = `# Auto-generated by DMS - do not edit manually
|
||||
|
||||
cursor {
|
||||
size = ${size}`;
|
||||
|
||||
if (themeName)
|
||||
content += `\n theme = ${themeName}`;
|
||||
|
||||
if (hideWhenTyping)
|
||||
content += `\n hide_on_key_press = true`;
|
||||
|
||||
if (hideOnTouch)
|
||||
content += `\n hide_on_touch = true`;
|
||||
|
||||
if (inactiveTimeout > 0)
|
||||
content += `\n inactive_timeout = ${inactiveTimeout}`;
|
||||
|
||||
content += `\n}
|
||||
`;
|
||||
|
||||
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && cat > "${cursorPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
console.warn("HyprlandService: Failed to write cursor config:", output);
|
||||
return;
|
||||
}
|
||||
console.info("HyprlandService: Generated cursor config at", cursorPath);
|
||||
reloadConfig();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user