1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

theme revisions

This commit is contained in:
bbedward
2025-08-01 09:29:31 -04:00
parent be6ef5fc77
commit 18ee37e18e
10 changed files with 366 additions and 265 deletions

View File

@@ -14,6 +14,8 @@ Singleton {
readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation)
readonly property string homeDir: _homeUrl.startsWith("file://") ? _homeUrl.substring(7) : _homeUrl
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
readonly property string configDir: _configUrl.startsWith("file://") ? _configUrl.substring(7) : _configUrl
readonly property string shellDir: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Common/", "")
readonly property string wallpaperPath: Prefs.wallpaperPath
property bool matugenAvailable: false
@@ -301,7 +303,7 @@ palette = 15=${fg_b}`;
console.log("Qt theming enabled:", qtTheming);
systemThemeGenerationInProgress = true;
systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, homeDir, "generate", isLight, iconTheme, gtkTheming, qtTheming];
systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, configDir, "generate", isLight, iconTheme, gtkTheming, qtTheming];
systemThemeGenerator.running = true;
}
@@ -335,7 +337,7 @@ palette = 15=${fg_b}`;
console.log("GTK theming enabled:", gtkTheming);
console.log("Qt theming enabled:", qtTheming);
systemThemeRestoreProcess.command = [shellDir + "/generate-themes.sh", "", shellDir, homeDir, "restore", isLight, iconTheme, gtkTheming, qtTheming];
systemThemeRestoreProcess.command = [shellDir + "/generate-themes.sh", "", shellDir, configDir, "restore", isLight, iconTheme, gtkTheming, qtTheming];
systemThemeRestoreProcess.running = true;
}
@@ -365,7 +367,7 @@ palette = 15=${fg_b}`;
Process {
id: gtkAvailabilityChecker
command: ["bash", "-c", "command -v gsettings >/dev/null && [ -d ~/.config/gtk-3.0 -o -d ~/.config/gtk-4.0 ]"]
command: ["bash", "-c", "command -v gsettings >/dev/null && [ -d " + configDir + "/gtk-3.0 -o -d " + configDir + "/gtk-4.0 ]"]
running: false
onExited: (exitCode) => {
gtkThemingEnabled = (exitCode === 0);
@@ -406,10 +408,6 @@ palette = 15=${fg_b}`;
if (exitCode === 0) {
console.log("System themes generated successfully");
console.log("stdout:", systemThemeStdout.text);
// GTK theme application is now handled by the simplified generate-themes.sh script
ToastService.showInfo("System themes updated successfully");
} else {
console.error("System theme generation failed, exit code:", exitCode);
console.error("stdout:", systemThemeStdout.text);

View File

@@ -59,6 +59,8 @@ Singleton {
readonly property string defaultMonoFontFamily: "Fira Code"
readonly property string _homeUrl: StandardPaths.writableLocation(StandardPaths.HomeLocation)
readonly property string _configUrl: StandardPaths.writableLocation(StandardPaths.ConfigLocation)
readonly property string _configDir: _configUrl.startsWith("file://") ? _configUrl.substring(7) : _configUrl
Timer {
id: fontCheckTimer
@@ -433,10 +435,10 @@ Singleton {
"fi\n" +
"\n" +
"# Ensure config directories exist\n" +
"mkdir -p ~/.config/gtk-3.0 ~/.config/gtk-4.0\n" +
"mkdir -p " + _configDir + "/gtk-3.0 " + _configDir + "/gtk-4.0\n" +
"\n" +
"# Update settings.ini files (keep existing gtk-theme-name)\n" +
"for config_dir in ~/.config/gtk-3.0 ~/.config/gtk-4.0; do\n" +
"for config_dir in " + _configDir + "/gtk-3.0 " + _configDir + "/gtk-4.0; do\n" +
" settings_file=\"$config_dir/settings.ini\"\n" +
" if [ -f \"$settings_file\" ]; then\n" +
" # Update existing icon-theme-name line or add it\n" +
@@ -485,9 +487,9 @@ Singleton {
" ' \"$config_file\" > \"$config_file.tmp\" && mv \"$config_file.tmp\" \"$config_file\"\n" +
" fi\n" +
"}\n" +
"remove_icon_theme " + home + "/.config/qt5ct/qt5ct.conf\n" +
"remove_icon_theme " + home + "/.config/qt6ct/qt6ct.conf\n" +
"rm -f " + home + "/.config/environment.d/95-qtct.conf 2>/dev/null || true\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" +
"systemctl --user import-environment --unset=QT_QPA_PLATFORMTHEME --unset=QT_QPA_PLATFORMTHEME_QT6 2>/dev/null || true\n" +
"dbus-update-activation-environment --systemd QT_QPA_PLATFORMTHEME= QT_QPA_PLATFORMTHEME_QT6= 2>/dev/null || true\n" +
"rm -rf " + home + "/.cache/icon-cache " + home + "/.cache/thumbnails 2>/dev/null || true\n";
@@ -497,7 +499,7 @@ Singleton {
}
var script =
"mkdir -p " + home + "/.config/qt5ct " + home + "/.config/qt6ct " + home + "/.config/environment.d 2>/dev/null || true\n" +
"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" +
@@ -528,15 +530,15 @@ Singleton {
" printf '[Appearance]\\nicon_theme=%s\\n' \"$theme_name\" > \"$config_file\"\n" +
" fi\n" +
"}\n" +
"update_qt_config " + home + "/.config/qt5ct/qt5ct.conf " + _shq(qtThemeName) + "\n" +
"update_qt_config " + home + "/.config/qt6ct/qt6ct.conf " + _shq(qtThemeName) + "\n" +
"update_qt_config " + _configDir + "/qt5ct/qt5ct.conf " + _shq(qtThemeName) + "\n" +
"update_qt_config " + _configDir + "/qt6ct/qt6ct.conf " + _shq(qtThemeName) + "\n" +
"if command -v qt5ct >/dev/null 2>&1; then\n" +
" printf 'QT_QPA_PLATFORMTHEME=qt5ct\\n' > " + home + "/.config/environment.d/95-qtct.conf\n" +
" printf 'QT_QPA_PLATFORMTHEME=qt5ct\\n' > " + _configDir + "/environment.d/95-qtct.conf\n" +
" if command -v qt6ct >/dev/null 2>&1; then\n" +
" printf 'QT_QPA_PLATFORMTHEME_QT6=qt6ct\\n' >> " + home + "/.config/environment.d/95-qtct.conf\n" +
" printf 'QT_QPA_PLATFORMTHEME_QT6=qt6ct\\n' >> " + _configDir + "/environment.d/95-qtct.conf\n" +
" fi\n" +
"else\n" +
" rm -f " + home + "/.config/environment.d/95-qtct.conf 2>/dev/null || true\n" +
" rm -f " + _configDir + "/environment.d/95-qtct.conf 2>/dev/null || true\n" +
"fi\n" +
"systemctl --user import-environment QT_QPA_PLATFORMTHEME QT_QPA_PLATFORMTHEME_QT6 2>/dev/null || true\n" +
"dbus-update-activation-environment --systemd QT_QPA_PLATFORMTHEME QT_QPA_PLATFORMTHEME_QT6 2>/dev/null || true\n" +