Add effective desktop style controls

This commit is contained in:
Gabriel Brown
2026-08-18 12:57:54 -04:00
parent f9eba1e8c5
commit df1dcdfad5
10 changed files with 837 additions and 29 deletions
@@ -25,25 +25,14 @@ import qs.config
Singleton {
id: root
property string cursorTheme: ""
property string lastError: ""
readonly property bool busy: themeQuery.running || runner.running || root.pending.length > 0
readonly property bool busy: runner.running || root.pending.length > 0
readonly property string cursorTheme: DesktopPreferences.get("cursorTheme")
readonly property int cursorSize: DesktopPreferences.get("cursorSize")
readonly property real textScale: DesktopPreferences.get("textScale")
Process {
id: themeQuery
command: ["gsettings", "get", "org.gnome.desktop.interface", "cursor-theme"]
stdout: StdioCollector {
onStreamFinished: {
// gsettings quotes strings: 'oreo_blue_cursors'
root.cursorTheme = this.text.trim().replace(/^'|'$/g, "");
}
}
}
// A short queue, because applying one setting takes several commands and
// Process runs one at a time.
property var pending: []
@@ -71,7 +60,6 @@ Singleton {
}
Component.onCompleted: {
themeQuery.running = true;
settle.restart();
}
@@ -102,10 +90,7 @@ Singleton {
["gsettings", "set", "org.gnome.desktop.interface", "cursor-size", size],
["gsettings", "set", "org.gnome.desktop.interface", "text-scaling-factor", String(root.textScale)]
];
// setcursor needs a theme name; skip it rather than guess if gsettings
// has not answered yet. The next change will catch up.
if (root.cursorTheme !== "")
commands.push(["hyprctl", "setcursor", root.cursorTheme, size]);
commands.push(["hyprctl", "setcursor", root.cursorTheme, size]);
root.enqueue(commands);
}
}