From 8fb06fddf597e6620b891f3020a9eecd86b7ac89 Mon Sep 17 00:00:00 2001 From: Lysec Date: Fri, 13 Mar 2026 19:18:23 +0100 Subject: [PATCH] fix(ghostty): add config.ghostty support --- Scripts/bash/template-apply.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Scripts/bash/template-apply.sh b/Scripts/bash/template-apply.sh index 6e425a575..a0a837a69 100755 --- a/Scripts/bash/template-apply.sh +++ b/Scripts/bash/template-apply.sh @@ -23,23 +23,31 @@ kitty) ;; 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 (flexible spacing) - if grep -qE "^theme\s*=\s*noctalia$" "$CONFIG_FILE"; then - : # Already correct - elif grep -qE "^theme\s*=" "$CONFIG_FILE"; then - # Replace existing theme line in-place - sed -i -E 's/^theme\s*=.*/theme = noctalia/' "$CONFIG_FILE" - else - # Add the new theme line to the end of the file - echo "theme = noctalia" >>"$CONFIG_FILE" + # Check both potential config files + CONFIG_FILES=("$HOME/.config/ghostty/config" "$HOME/.config/ghostty/config.ghostty") + FOUND_CONFIG=false + + for CONFIG_FILE in "${CONFIG_FILES[@]}"; do + if [ -f "$CONFIG_FILE" ]; then + FOUND_CONFIG=true + # Check if theme is already set to noctalia (flexible spacing) + if grep -qE "^theme\s*=\s*noctalia$" "$CONFIG_FILE"; then + : # Already correct + elif grep -qE "^theme\s*=" "$CONFIG_FILE"; then + # Replace existing theme line in-place + sed -i -E 's/^theme\s*=.*/theme = noctalia/' "$CONFIG_FILE" + else + # Add the new theme line to the end of the file + echo "theme = noctalia" >>"$CONFIG_FILE" + fi fi + done + + if [ "$FOUND_CONFIG" = true ]; then # Only signal if ghostty is running pgrep -f ghostty >/dev/null && pkill -SIGUSR2 ghostty || true else - echo "Error: ghostty config file not found at $CONFIG_FILE" >&2 + echo "Error: No ghostty config file found at ${CONFIG_FILES[*]}" >&2 exit 1 fi ;;