From ac73426aa1a8d45ab8f2a6f3c6ccc6df9649a6e3 Mon Sep 17 00:00:00 2001 From: Corey Woodworth Date: Sat, 1 Nov 2025 23:48:02 -0400 Subject: [PATCH] Added wezterm to MatugenTemplates.qml --- Bin/colors-apply.sh | 334 +++++++++++++++++----------------- Services/MatugenTemplates.qml | 4 + 2 files changed, 176 insertions(+), 162 deletions(-) diff --git a/Bin/colors-apply.sh b/Bin/colors-apply.sh index 0e920ca6..be17d0d5 100755 --- a/Bin/colors-apply.sh +++ b/Bin/colors-apply.sh @@ -1,6 +1,5 @@ #!/usr/bin/env -S bash - # Ensure exactly one argument is provided. if [ "$#" -ne 1 ]; then # Print usage information to standard error. @@ -13,190 +12,201 @@ APP_NAME="$1" # --- Apply theme based on the application name --- case "$APP_NAME" in - kitty) - echo "🎨 Applying 'noctalia' theme to kitty..." - kitty +kitten themes --reload-in=all noctalia - ;; +kitty) + echo "🎨 Applying 'noctalia' theme to kitty..." + kitty +kitten themes --reload-in=all noctalia + ;; - ghostty) - echo "🎨 Applying 'noctalia' theme to ghostty..." - CONFIG_FILE="$HOME/.config/ghostty/config" - # Check if the config file exists before trying to modify it. - 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 - # Remove any existing theme include line to prevent duplicates. - sed -i '/theme/d' "$CONFIG_FILE" - # Add the new theme include line to the end of the file. - echo "theme = noctalia" >> "$CONFIG_FILE" - fi - pkill -SIGUSR2 ghostty +ghostty) + echo "🎨 Applying 'noctalia' theme to ghostty..." + CONFIG_FILE="$HOME/.config/ghostty/config" + # Check if the config file exists before trying to modify it. + 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 - echo "Error: ghostty config file not found at $CONFIG_FILE" >&2 - exit 1 + # Remove any existing theme include line to prevent duplicates. + sed -i '/theme/d' "$CONFIG_FILE" + # Add the new theme include line to the end of the file. + echo "theme = noctalia" >>"$CONFIG_FILE" fi - ;; + pkill -SIGUSR2 ghostty + else + echo "Error: ghostty config file not found at $CONFIG_FILE" >&2 + exit 1 + fi + ;; - foot) - echo "🎨 Applying 'noctalia' theme to foot..." - CONFIG_FILE="$HOME/.config/foot/foot.ini" +foot) + echo "🎨 Applying 'noctalia' theme to foot..." + CONFIG_FILE="$HOME/.config/foot/foot.ini" - # Check if the config file exists, create it if it doesn't. - if [ ! -f "$CONFIG_FILE" ]; then - echo "Config file not found, creating $CONFIG_FILE..." - # Create the config directory if it doesn't exist - mkdir -p "$(dirname "$CONFIG_FILE")" - # Create the config file with the noctalia theme - cat > "$CONFIG_FILE" << 'EOF' + # Check if the config file exists, create it if it doesn't. + if [ ! -f "$CONFIG_FILE" ]; then + echo "Config file not found, creating $CONFIG_FILE..." + # Create the config directory if it doesn't exist + mkdir -p "$(dirname "$CONFIG_FILE")" + # Create the config file with the noctalia theme + cat >"$CONFIG_FILE" <<'EOF' [main] include=~/.config/foot/themes/noctalia EOF - echo "Created new config file with noctalia theme." + echo "Created new config file with noctalia theme." + else + # Check if theme is already set to noctalia + if grep -q "include=~/.config/foot/themes/noctalia" "$CONFIG_FILE"; then + echo "Theme already set to noctalia, skipping modification." else - # Check if theme is already set to noctalia - if grep -q "include=~/.config/foot/themes/noctalia" "$CONFIG_FILE"; then - echo "Theme already set to noctalia, skipping modification." + # Remove any existing theme include line to prevent duplicates. + sed -i '/include=.*themes/d' "$CONFIG_FILE" + if grep -q '^\[main\]' "$CONFIG_FILE"; then + # Insert the include line after the existing [main] section header + sed -i '/^\[main\]/a include=~/.config/foot/themes/noctalia' "$CONFIG_FILE" else - # Remove any existing theme include line to prevent duplicates. - sed -i '/include=.*themes/d' "$CONFIG_FILE" - if grep -q '^\[main\]' "$CONFIG_FILE"; then - # Insert the include line after the existing [main] section header - sed -i '/^\[main\]/a include=~/.config/foot/themes/noctalia' "$CONFIG_FILE" + # If [main] doesn't exist, create it at the beginning with the include + sed -i '1i [main]\ninclude=~/.config/foot/themes/noctalia\n' "$CONFIG_FILE" + fi + fi + fi + ;; + +alacritty) + echo "🎨 Applying 'noctalia' theme to alacritty..." + CONFIG_FILE="$HOME/.config/alacritty/alacritty.toml" + + # Check if the config file exists. + if [ -f "$CONFIG_FILE" ]; then + # Check if theme is already imported + if grep -q 'import = \[.*"themes/noctalia.toml".*\]' "$CONFIG_FILE"; then + echo "Theme already set to noctalia, skipping modification." + else + # Check if [general] section exists + if grep -q '^\[general\]' "$CONFIG_FILE"; then + # Check if import line exists under [general] + if sed -n '/^\[general\]/,/^\[/p' "$CONFIG_FILE" | grep -q '^import = \['; then + # Replace existing import line with noctalia theme + sed -i '/^\[general\]/,/^\[/{s|^import = \[.*\]|import = ["themes/noctalia.toml"]|}' "$CONFIG_FILE" else - # If [main] doesn't exist, create it at the beginning with the include - sed -i '1i [main]\ninclude=~/.config/foot/themes/noctalia\n' "$CONFIG_FILE" + # Add import line after [general] section + sed -i '/^\[general\]/a import = ["themes/noctalia.toml"]' "$CONFIG_FILE" + fi + else + # Create [general] section with import at the beginning of the file + sed -i '1i [general]\nimport = ["themes/noctalia.toml"]\n' "$CONFIG_FILE" + fi + fi + else + echo "Error: alacritty config file not found at $CONFIG_FILE" >&2 + exit 1 + fi + ;; + +wezterm) + echo "🎨 Applying 'noctalia' theme to wezterm..." + CONFIG_FILE="$HOME/.config/wezterm/wezterm.lua" + # might need this, not sure yet. + THEME_FILE="$HOME/.config/wezterm/colors/Noctalia.toml" + local wezterm_scheme_line="config\.color\_scheme = \"Noctalia\"" + + # Check if the config file exists. + if [ -f "$CONFIG_FILE" ]; then + + # Check if theme is already set to Noctalia (matches 'Noctalia' or "Noctalia") + # We use "..." for the grep string and escape the internal [\"'] + if grep -q "^\s*config\.color\_scheme\s*\=\s*[\'\"]Noctalia[\'\"]\s*" "$CONFIG_FILE"; then + echo "Theme already set to Noctalia, skipping modification." + else + # Not set to Noctalia. Check if *any* color_scheme line exists. + if grep -q '^\s*config\.color\_scheme\s*\=' "$CONFIG_FILE"; then + # It exists, so we replace it with our desired (double-quoted) line. + sed -i "s|^\(\s*config\.color_scheme\s*=\s*\).*$|\1$wezterm_scheme_line|" "$CONFIG_FILE" + else + # It doesn't exist, so we add it. + # We must insert it before the 'return config' line. + + if grep -q '^\s*return\s*config' "$CONFIG_FILE"; then + # It exists. Insert the line before it. + sed -i "/^\s*return\s*config/i\\$wezterm_scheme_line" "$CONFIG_FILE" + else + # This is a problem. We can't find the insertion point. + echo "Warning: 'config.color_scheme' not set and 'return config' line not found." >&2 + echo " Please add '$wezterm_scheme_line' to $CONFIG_FILE manually." >&2 fi fi fi - ;; + else + echo "Error: wezterm config file not found at $CONFIG_FILE" >&2 + exit 1 + fi + ;; - alacritty) - echo "🎨 Applying 'noctalia' theme to alacritty..." - CONFIG_FILE="$HOME/.config/alacritty/alacritty.toml" +fuzzel) + echo "🎨 Applying 'noctalia' theme to fuzzel..." + CONFIG_FILE="$HOME/.config/fuzzel/fuzzel.ini" - # Check if the config file exists. - if [ -f "$CONFIG_FILE" ]; then - # Check if theme is already imported - if grep -q 'import = \[.*"themes/noctalia.toml".*\]' "$CONFIG_FILE"; then - echo "Theme already set to noctalia, skipping modification." - else - # Check if [general] section exists - if grep -q '^\[general\]' "$CONFIG_FILE"; then - # Check if import line exists under [general] - if sed -n '/^\[general\]/,/^\[/p' "$CONFIG_FILE" | grep -q '^import = \['; then - # Replace existing import line with noctalia theme - sed -i '/^\[general\]/,/^\[/{s|^import = \[.*\]|import = ["themes/noctalia.toml"]|}' "$CONFIG_FILE" - else - # Add import line after [general] section - sed -i '/^\[general\]/a import = ["themes/noctalia.toml"]' "$CONFIG_FILE" - fi - else - # Create [general] section with import at the beginning of the file - sed -i '1i [general]\nimport = ["themes/noctalia.toml"]\n' "$CONFIG_FILE" - fi - fi - else - echo "Error: alacritty config file not found at $CONFIG_FILE" >&2 - exit 1 - fi - ;; - - wezterm) - echo "🎨 Applying 'noctalia' theme to wezterm..." - CONFIG_FILE="$HOME/.config/wezterm/wezterm.lua" - # might need this, not sure yet. - THEME_FILE="$HOME/.config/wezterm/colors/Noctalia.toml" - - # Check if the config file exists. - if [ -f "$CONFIG_FILE" ]; then - # Check if theme is already set - if grep -q '^\s*config\.color_scheme\s*=\s*["']Noctalia["']' "$CONFIG_FILE"; then - echo "Theme already set to noctalia, skipping modification." - else - # Check if config.color_scheme line exists - if grep -q '^\s*config\.color_scheme\s*=' "$CONFIG_FILE"; then - # Needs to replace config.color_scheme line with config.color_scheme = "Noctalia" - sed -i 's/^\(\s*config\.color_scheme\s*=\s*\).*$/\1'"'"'Noctalia'"'"'/' "$CONFIG_FILE" - else - # No color_scheme added yet. - # Just needs to add config.color_scheme = "Noctalia" somewhere after local config = wezterm.config_builder() and before the return config line - sed -i '/^\s*return\s*config/i config.color_scheme = '"'"'Noctalia'"'"'\n' "$CONFIG_FILE" - fi - fi - else - echo "Error: wezterm config file not found at $CONFIG_FILE" >&2 - exit 1 - fi - ;; - - fuzzel) - echo "🎨 Applying 'noctalia' theme to fuzzel..." - CONFIG_FILE="$HOME/.config/fuzzel/fuzzel.ini" - - # Check if the config file exists, create it if it doesn't. - if [ ! -f "$CONFIG_FILE" ]; then - echo "Config file not found, creating $CONFIG_FILE..." - # Create the config directory if it doesn't exist - mkdir -p "$(dirname "$CONFIG_FILE")" - # Create the config file with the noctalia theme - cat > "$CONFIG_FILE" << 'EOF' + # Check if the config file exists, create it if it doesn't. + if [ ! -f "$CONFIG_FILE" ]; then + echo "Config file not found, creating $CONFIG_FILE..." + # Create the config directory if it doesn't exist + mkdir -p "$(dirname "$CONFIG_FILE")" + # Create the config file with the noctalia theme + cat >"$CONFIG_FILE" <<'EOF' include=~/.config/fuzzel/themes/noctalia EOF - echo "Created new config file with noctalia theme." + echo "Created new config file with noctalia theme." + else + # Check if theme is already set to noctalia + if grep -q "include=~/.config/fuzzel/themes/noctalia" "$CONFIG_FILE"; then + echo "Theme already set to noctalia, skipping modification." else - # Check if theme is already set to noctalia - if grep -q "include=~/.config/fuzzel/themes/noctalia" "$CONFIG_FILE"; then - echo "Theme already set to noctalia, skipping modification." + # Remove any existing theme include line. + sed -i '/themes/d' "$CONFIG_FILE" + # Add the new theme include line. + echo "include=~/.config/fuzzel/themes/noctalia" >>"$CONFIG_FILE" + fi + 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 - # Remove any existing theme include line. - sed -i '/themes/d' "$CONFIG_FILE" - # Add the new theme include line. - echo "include=~/.config/fuzzel/themes/noctalia" >> "$CONFIG_FILE" + echo 'theme = "noctalia"' >>"$CONFIG_FILE" fi 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 - vicinae theme set matugen - ;; - - pywalfox) - echo "🎨 Updating pywalfox themes..." - pywalfox update - ;; - - *) - # Handle unknown application names. - echo "Error: Unknown application '$APP_NAME'." >&2 + 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 + vicinae theme set matugen + ;; + +pywalfox) + echo "🎨 Updating pywalfox themes..." + pywalfox update + ;; + +*) + # Handle unknown application names. + echo "Error: Unknown application '$APP_NAME'." >&2 + exit 1 + ;; esac echo "✅ Command sent for $APP_NAME." diff --git a/Services/MatugenTemplates.qml b/Services/MatugenTemplates.qml index 606fa1fb..2f7ab906 100644 --- a/Services/MatugenTemplates.qml +++ b/Services/MatugenTemplates.qml @@ -107,6 +107,10 @@ Singleton { "name": "alacritty", "path": "Terminal/alacritty.toml", "output": "~/.config/alacritty/themes/noctalia.toml" + }, { + "name": "wezterm", + "path": "Terminal/wezterm.toml", + "output": "~/.config/wezterm/colors/Noctalia.toml" }] terminals.forEach(function (terminal) {