From 38f698747b9e8e331f12a99db155ee1ccd3d666c Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Tue, 14 Oct 2025 20:13:41 -0400 Subject: [PATCH] Foot term theming: Fix #475 --- Bin/colors-apply.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Bin/colors-apply.sh b/Bin/colors-apply.sh index 3febd53f..4c23afa1 100755 --- a/Bin/colors-apply.sh +++ b/Bin/colors-apply.sh @@ -41,9 +41,15 @@ case "$APP_NAME" in # Check if the config file exists before trying to modify it. if [ -f "$CONFIG_FILE" ]; then # Remove any existing theme include line to prevent duplicates. - sed -i '/themes/d' "$CONFIG_FILE" - # Add the new theme include line to the end of the file. - echo "include=~/.config/foot/themes/noctalia" >> "$CONFIG_FILE" + 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 + # 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 else echo "Error: foot config file not found at $CONFIG_FILE" >&2 exit 1