diff --git a/Bin/colors-apply.sh b/Bin/colors-apply.sh index 9027dbd8..77fa3f64 100755 --- a/Bin/colors-apply.sh +++ b/Bin/colors-apply.sh @@ -5,7 +5,7 @@ if [ "$#" -ne 1 ]; then # Print usage information to standard error. echo "Error: No application specified." >&2 - echo "Usage: $0 {kitty|ghostty|foot|fuzzel|pywalfox}" >&2 + echo "Usage: $0 {kitty|ghostty|foot|fuzzel|walker|pywalfox}" >&2 exit 1 fi @@ -86,6 +86,29 @@ case "$APP_NAME" in fi ;; + walker) + echo "🎨 Applying 'noctalia' theme to walker..." + CONFIG_FILE="$HOME/.config/walker/config.toml" + + # Check if the config file exists. + if [ -f "$CONFIG_FILE" ]; then + # Check if theme is already set to noctalia + if grep -q '^theme = "noctalia"' "$CONFIG_FILE"; then + echo "Theme already set to noctalia, skipping modification." + else + # Check if a theme line exists and replace it, otherwise append + if grep -q '^theme = ' "$CONFIG_FILE"; then + sed -i 's/^theme = .*/theme = "noctalia"/' "$CONFIG_FILE" + else + echo 'theme = "noctalia"' >> "$CONFIG_FILE" + fi + fi + else + echo "Error: walker config file not found at $CONFIG_FILE" >&2 + exit 1 + fi + ;; + vicinae) echo "🎨 Applying 'matugen' theme to vicinae..." # Apply the theme diff --git a/Modules/Settings/Tabs/ColorSchemeTab.qml b/Modules/Settings/Tabs/ColorSchemeTab.qml index 09377a46..ded074a4 100644 --- a/Modules/Settings/Tabs/ColorSchemeTab.qml +++ b/Modules/Settings/Tabs/ColorSchemeTab.qml @@ -697,51 +697,6 @@ ColumnLayout { onToggled: checked => { if (ProgramCheckerService.walkerAvailable) { Settings.data.templates.walker = checked - if (checked) { - // Update walker config.toml to use noctalia theme - var configFile = Quickshell.env("HOME") + "/.config/walker/config.toml" - var configDir = Quickshell.env("HOME") + "/.config/walker" - var configFileEsc = configFile.replace(/'/g, "'\\''") - var configDirEsc = configDir.replace(/'/g, "'\\''") - - Logger.i("ColorSchemeTab", "Updating walker config:", configFile) - Logger.d("ColorSchemeTab", "Config file path:", configFileEsc) - Logger.d("ColorSchemeTab", "Config dir path:", configDirEsc) - - // Remove existing theme line and insert new one at the top - var script = "echo '[Walker Config] Starting update...' && " - script += "mkdir -p '" + configDirEsc + "' && " - script += "echo '[Walker Config] Directory created/verified' && " - script += "if [ -f '" + configFileEsc + "' ]; then " - script += "echo '[Walker Config] File exists, removing old theme line' && " - script += "(grep -v '^theme[[:space:]]*=' '" + configFileEsc + "' > '" + configFileEsc + ".tmp' 2>/dev/null || cat '" + configFileEsc + "' > '" + configFileEsc + ".tmp') && " - script += "mv '" + configFileEsc + ".tmp' '" + configFileEsc + "' && " - script += "echo '[Walker Config] Removed old theme line'; " - script += "else echo '[Walker Config] File does not exist, will create'; " - script += "fi && " - script += "echo 'theme = \"noctalia\"' | cat - '" + configFileEsc + "' > '" + configFileEsc + ".tmp' && " - script += "mv '" + configFileEsc + ".tmp' '" + configFileEsc + "' && " - script += "echo '[Walker Config] Inserted theme at top' && " - script += "FINAL_THEME=$(grep '^theme' '" + configFileEsc + "' | head -1 2>/dev/null) && " - script += "echo '[Walker Config] Final theme line: '$FINAL_THEME || echo '[Walker Config] ERROR: Theme line not found after update'" - - Logger.d("ColorSchemeTab", "Executing script:", script) - - // Execute script using execDetached - Quickshell.execDetached(["sh", "-c", script]) - - // Verify the update after a short delay - Qt.callLater(function () { - var verifyScript = "grep '^theme' '" + configFileEsc + "' | head -1 2>/dev/null || echo 'NOT_FOUND'" - var verifyProcessStr = "import QtQuick; import Quickshell.Io; Process { command: [\"sh\", \"-c\", \"" + verifyScript.replace(/"/g, '\\"') + "\"]; stdout: StdioCollector {} }" - var verifyProcess = Qt.createQmlObject(verifyProcessStr, root, "walkerVerify") - verifyProcess.exited.connect(function (exitCode) { - Logger.i("ColorSchemeTab", "Walker theme verification:", verifyProcess.stdout.text || "NOT FOUND") - verifyProcess.destroy() - }) - verifyProcess.running = true - }) - } AppThemeService.generate() } } diff --git a/Services/AppThemeService.qml b/Services/AppThemeService.qml index ae5f7456..2f3d85a7 100644 --- a/Services/AppThemeService.qml +++ b/Services/AppThemeService.qml @@ -115,6 +115,7 @@ Singleton { "outputs": [{ "path": "~/.config/walker/themes/noctalia/style.css" }], + "postProcess": () => `${colorsApplyScript} walker\n`, "strict": true } })