icons: probe the system theme when DMS has none set

fixes #1132
This commit is contained in:
bbedward
2026-08-27 09:56:32 -04:00
parent 530c58b928
commit fdffc61d39
+20 -1
View File
@@ -11,12 +11,14 @@ Singleton {
id: root
readonly property var log: Log.scoped("IconThemeService")
readonly property string managedTheme: {
readonly property string settingsTheme: {
if (typeof SettingsData === "undefined")
return "";
const t = SettingsData.resolveIconTheme();
return (!t || t === "System Default") ? "" : t;
}
property string systemProbedTheme: ""
readonly property string managedTheme: settingsTheme || systemProbedTheme
property var _searchDirs: []
property string _dirsForTheme: ""
@@ -39,9 +41,26 @@ Singleton {
onManagedThemeChanged: _rebuild()
Component.onCompleted: {
Paths.iconResolver = name => resolve(name);
_probeSystemTheme();
_rebuild();
}
// "System Default" leaves Qt's lookup, which sees only hicolor unless a Qt platform theme or QS_ICON_THEME is configured.
function _probeSystemTheme() {
if (Quickshell.env("QS_ICON_THEME"))
return;
const script = `v=$(sed -n 's/^gtk-icon-theme-name *= *//p' "\${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" 2>/dev/null | head -1)
[ -z "$v" ] && command -v gsettings >/dev/null 2>&1 && v=$(gsettings get org.gnome.desktop.interface icon-theme 2>/dev/null)
printf '%s' "$v" | tr -d "'\\""`;
Proc.runCommand("iconThemeProbe", ["sh", "-c", script], (out, code) => {
const theme = (out || "").trim();
if (!theme)
return;
root.systemProbedTheme = theme;
});
}
function _bumpRevision() {
if (_bumpPending)
return;