mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-27 15:02:50 -05:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -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
|
||||
@@ -292,12 +294,16 @@ palette = 15=${fg_b}`;
|
||||
// Get current theme preferences
|
||||
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false";
|
||||
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false";
|
||||
|
||||
console.log("Theme mode:", isLight === "true" ? "light" : "dark");
|
||||
console.log("Icon theme:", iconTheme);
|
||||
console.log("GTK theming enabled:", gtkTheming);
|
||||
console.log("Qt theming enabled:", qtTheming);
|
||||
|
||||
systemThemeGenerationInProgress = true;
|
||||
systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, homeDir, "generate", isLight, iconTheme];
|
||||
systemThemeGenerator.command = [shellDir + "/generate-themes.sh", wallpaperPath, shellDir, configDir, "generate", isLight, iconTheme, gtkTheming, qtTheming];
|
||||
systemThemeGenerator.running = true;
|
||||
}
|
||||
|
||||
@@ -323,11 +329,15 @@ palette = 15=${fg_b}`;
|
||||
// Get current theme preferences
|
||||
const isLight = (typeof Theme !== "undefined" && Theme.isLightMode) ? "true" : "false";
|
||||
const iconTheme = (typeof Prefs !== "undefined" && Prefs.iconTheme) ? Prefs.iconTheme : "System Default";
|
||||
const gtkTheming = (typeof Prefs !== "undefined" && Prefs.gtkThemingEnabled) ? "true" : "false";
|
||||
const qtTheming = (typeof Prefs !== "undefined" && Prefs.qtThemingEnabled) ? "true" : "false";
|
||||
|
||||
console.log("Restoring to theme mode:", isLight === "true" ? "light" : "dark");
|
||||
console.log("Icon theme:", iconTheme);
|
||||
console.log("GTK theming enabled:", gtkTheming);
|
||||
console.log("Qt theming enabled:", qtTheming);
|
||||
|
||||
systemThemeRestoreProcess.command = [shellDir + "/generate-themes.sh", "", shellDir, homeDir, "restore", isLight, iconTheme];
|
||||
systemThemeRestoreProcess.command = [shellDir + "/generate-themes.sh", "", shellDir, configDir, "restore", isLight, iconTheme, gtkTheming, qtTheming];
|
||||
systemThemeRestoreProcess.running = true;
|
||||
}
|
||||
|
||||
@@ -357,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);
|
||||
@@ -398,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);
|
||||
|
||||
@@ -88,6 +88,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
|
||||
@@ -590,10 +592,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" +
|
||||
@@ -642,9 +644,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";
|
||||
@@ -654,7 +656,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" +
|
||||
@@ -685,15 +687,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" +
|
||||
@@ -702,6 +704,7 @@ Singleton {
|
||||
Quickshell.execDetached(["sh", "-lc", script]);
|
||||
}
|
||||
|
||||
|
||||
function applyStoredIconTheme() {
|
||||
updateGtkIconTheme(iconTheme);
|
||||
updateQtIconTheme(iconTheme);
|
||||
|
||||
Reference in New Issue
Block a user