mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
cursor: create/update XResources for XWL apps
This commit is contained in:
@@ -1588,6 +1588,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateCompositorCursor() {
|
function updateCompositorCursor() {
|
||||||
|
updateXResources();
|
||||||
if (typeof CompositorService === "undefined")
|
if (typeof CompositorService === "undefined")
|
||||||
return;
|
return;
|
||||||
if (CompositorService.isNiri && typeof NiriService !== "undefined") {
|
if (CompositorService.isNiri && typeof NiriService !== "undefined") {
|
||||||
@@ -1604,6 +1605,36 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateXResources() {
|
||||||
|
const homeDir = Paths.strip(StandardPaths.writableLocation(StandardPaths.HomeLocation));
|
||||||
|
const xresourcesPath = homeDir + "/.Xresources";
|
||||||
|
const themeName = cursorSettings.theme === "System Default" ? systemDefaultCursorTheme : cursorSettings.theme;
|
||||||
|
const size = cursorSettings.size || 24;
|
||||||
|
|
||||||
|
if (!themeName)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const script = `
|
||||||
|
xresources_file="${xresourcesPath}"
|
||||||
|
temp_file="\${xresources_file}.tmp.$$"
|
||||||
|
theme_name="${themeName}"
|
||||||
|
cursor_size="${size}"
|
||||||
|
|
||||||
|
if [ -f "$xresources_file" ]; then
|
||||||
|
grep -v '^[[:space:]]*Xcursor\\.theme:' "$xresources_file" | grep -v '^[[:space:]]*Xcursor\\.size:' > "$temp_file" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
touch "$temp_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Xcursor.theme: $theme_name" >> "$temp_file"
|
||||||
|
echo "Xcursor.size: $cursor_size" >> "$temp_file"
|
||||||
|
mv "$temp_file" "$xresources_file"
|
||||||
|
xrdb -merge "$xresources_file" 2>/dev/null || true
|
||||||
|
`;
|
||||||
|
|
||||||
|
Quickshell.execDetached(["sh", "-c", script]);
|
||||||
|
}
|
||||||
|
|
||||||
function getCursorEnvironment() {
|
function getCursorEnvironment() {
|
||||||
const isSystemDefault = cursorSettings.theme === "System Default";
|
const isSystemDefault = cursorSettings.theme === "System Default";
|
||||||
const isDefaultSize = !cursorSettings.size || cursorSettings.size === 24;
|
const isDefaultSize = !cursorSettings.size || cursorSettings.size === 24;
|
||||||
|
|||||||
Reference in New Issue
Block a user