From dd10b93afe5d4474d38d397be6b58244231fb85e Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 19 Aug 2025 15:47:51 -0400 Subject: [PATCH] leave icon theme alone when its system default --- Common/SettingsData.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/SettingsData.qml b/Common/SettingsData.qml index f0281cba..59117e34 100644 --- a/Common/SettingsData.qml +++ b/Common/SettingsData.qml @@ -642,8 +642,8 @@ Singleton { var qtThemeName = (themeName === "System Default") ? "" : themeName; var home = _shq(root._homeUrl.replace("file://", "")); if (!qtThemeName) { - var revertScript = "remove_icon_theme() {\n" + " local config_file=\"$1\"\n" + " if [ -f \"$config_file\" ]; then\n" + " awk '\n" + " BEGIN { in_appearance = 0 }\n" + " /^\\[Appearance\\]/ { in_appearance = 1; print; next }\n" + " /^\\[/ && in_appearance { in_appearance = 0 }\n" + " in_appearance && /^icon_theme=/ { next }\n" + " { print }\n" + " ' \"$config_file\" > \"$config_file.tmp\" && mv \"$config_file.tmp\" \"$config_file\"\n" + " fi\n" + "}\n" + "remove_icon_theme " + _configDir + "/qt5ct/qt5ct.conf\n" + "remove_icon_theme " + _configDir + "/qt6ct/qt6ct.conf\n" + "rm -f " + _configDir + "/environment.d/95-qtct.conf 2>/dev/null || true\n" + "rm -rf " + home + "/.cache/icon-cache " + home + "/.cache/thumbnails 2>/dev/null || true\n"; - Quickshell.execDetached(["sh", "-lc", revertScript]); + // When "System Default" is selected, don't modify the config files at all + // This preserves the user's existing qt6ct configuration return ; } var script = "mkdir -p " + _configDir + "/qt5ct " + _configDir + "/qt6ct " + _configDir + "/environment.d 2>/dev/null || true\n" + "update_qt_config() {\n" + " local config_file=\"$1\"\n" + " local theme_name=\"$2\"\n" + " if [ -f \"$config_file\" ]; then\n" + " if grep -q '^\\[Appearance\\]' \"$config_file\"; then\n" + " awk -v theme=\"$theme_name\" '\n" + " BEGIN { in_appearance = 0; icon_theme_added = 0 }\n" + " /^\\[Appearance\\]/ { in_appearance = 1; print; next }\n" + " /^\\[/ && !/^\\[Appearance\\]/ { \n" + " if (in_appearance && !icon_theme_added) { \n" + " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n" + " in_appearance = 0; print; next \n" + " }\n" + " in_appearance && /^icon_theme=/ { \n" + " if (!icon_theme_added) { \n" + " print \"icon_theme=\" theme; icon_theme_added = 1 \n" + " } \n" + " next \n" + " }\n" + " { print }\n" + " END { if (in_appearance && !icon_theme_added) print \"icon_theme=\" theme }\n" + " ' \"$config_file\" > \"$config_file.tmp\" && mv \"$config_file.tmp\" \"$config_file\"\n" + " else\n" + " printf '\\n[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" >> \"$config_file\"\n" + " fi\n" + " else\n" + " printf '[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" > \"$config_file\"\n" + " fi\n" + "}\n" + "update_qt_config " + _configDir + "/qt5ct/qt5ct.conf " + _shq(qtThemeName) + "\n" + "update_qt_config " + _configDir + "/qt6ct/qt6ct.conf " + _shq(qtThemeName) + "\n" + "rm -rf " + home + "/.cache/icon-cache " + home + "/.cache/thumbnails 2>/dev/null || true\n";