mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-30 00:12:50 -05:00
hyprland: fix cursor setting
This commit is contained in:
@@ -247,8 +247,6 @@ decoration {
|
|||||||
if (!CompositorService.isHyprland)
|
if (!CompositorService.isHyprland)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
console.log("HyprlandService: Generating cursor config...");
|
|
||||||
|
|
||||||
const settings = typeof SettingsData !== "undefined" ? SettingsData.cursorSettings : null;
|
const settings = typeof SettingsData !== "undefined" ? SettingsData.cursorSettings : null;
|
||||||
if (!settings) {
|
if (!settings) {
|
||||||
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
||||||
@@ -260,13 +258,15 @@ decoration {
|
|||||||
|
|
||||||
const themeName = settings.theme === "System Default" ? (SettingsData.systemDefaultCursorTheme || "") : settings.theme;
|
const themeName = settings.theme === "System Default" ? (SettingsData.systemDefaultCursorTheme || "") : settings.theme;
|
||||||
const size = settings.size || 24;
|
const size = settings.size || 24;
|
||||||
const hideWhenTyping = settings.hyprland?.hideWhenTyping || false;
|
|
||||||
const hideOnTouch = settings.hyprland?.hideOnTouch || false;
|
|
||||||
const hideOnKeyPress = settings.hyprland?.hideOnKeyPress || false;
|
const hideOnKeyPress = settings.hyprland?.hideOnKeyPress || false;
|
||||||
|
const hideOnTouch = settings.hyprland?.hideOnTouch || false;
|
||||||
const inactiveTimeout = settings.hyprland?.inactiveTimeout || 0;
|
const inactiveTimeout = settings.hyprland?.inactiveTimeout || 0;
|
||||||
|
|
||||||
const isDefaultConfig = !themeName && size === 24 && !hideWhenTyping && !hideOnTouch && !hideOnKeyPress && inactiveTimeout === 0;
|
const hasTheme = themeName && themeName.length > 0;
|
||||||
if (isDefaultConfig) {
|
const hasNonDefaultSize = size !== 24;
|
||||||
|
const hasCursorSettings = hideOnKeyPress || hideOnTouch || inactiveTimeout > 0;
|
||||||
|
|
||||||
|
if (!hasTheme && !hasNonDefaultSize && !hasCursorSettings) {
|
||||||
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && : > "${cursorPath}"`], (output, exitCode) => {
|
||||||
if (exitCode !== 0)
|
if (exitCode !== 0)
|
||||||
console.warn("HyprlandService: Failed to write cursor config:", output);
|
console.warn("HyprlandService: Failed to write cursor config:", output);
|
||||||
@@ -274,32 +274,37 @@ decoration {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = `# Auto-generated by DMS - do not edit manually
|
let lines = ["# Auto-generated by DMS - do not edit manually", ""];
|
||||||
|
|
||||||
cursor {
|
if (hasTheme) {
|
||||||
size = ${size}`;
|
lines.push(`env = HYPRCURSOR_THEME,${themeName}`);
|
||||||
|
lines.push(`env = XCURSOR_THEME,${themeName}`);
|
||||||
|
}
|
||||||
|
lines.push(`env = HYPRCURSOR_SIZE,${size}`);
|
||||||
|
lines.push(`env = XCURSOR_SIZE,${size}`);
|
||||||
|
|
||||||
if (themeName)
|
if (hasCursorSettings) {
|
||||||
content += `\n theme = ${themeName}`;
|
lines.push("");
|
||||||
|
lines.push("cursor {");
|
||||||
|
if (hideOnKeyPress)
|
||||||
|
lines.push(" hide_on_key_press = true");
|
||||||
|
if (hideOnTouch)
|
||||||
|
lines.push(" hide_on_touch = true");
|
||||||
|
if (inactiveTimeout > 0)
|
||||||
|
lines.push(` inactive_timeout = ${inactiveTimeout}`);
|
||||||
|
lines.push("}");
|
||||||
|
}
|
||||||
|
|
||||||
if (hideWhenTyping)
|
lines.push("");
|
||||||
content += `\n hide_on_key_press = true`;
|
const content = lines.join("\n");
|
||||||
|
|
||||||
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) => {
|
Proc.runCommand("hypr-write-cursor", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && cat > "${cursorPath}" << 'EOF'\n${content}EOF`], (output, exitCode) => {
|
||||||
if (exitCode !== 0) {
|
if (exitCode !== 0) {
|
||||||
console.warn("HyprlandService: Failed to write cursor config:", output);
|
console.warn("HyprlandService: Failed to write cursor config:", output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.info("HyprlandService: Generated cursor config at", cursorPath);
|
if (hasTheme)
|
||||||
|
Proc.runCommand("hyprctl-setcursor", ["hyprctl", "setcursor", themeName, String(size)], () => {});
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user