mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
ColorsApply: avoid modifying config(s) if unnecessary.
This commit is contained in:
+37
-24
@@ -23,13 +23,18 @@ case "$APP_NAME" in
|
||||
CONFIG_FILE="$HOME/.config/ghostty/config"
|
||||
# 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 '/theme/d' "$CONFIG_FILE"
|
||||
# Add the new theme include line to the end of the file.
|
||||
echo "theme = noctalia" >> "$CONFIG_FILE"
|
||||
pkill -SIGUSR2 ghostty
|
||||
# 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"
|
||||
pkill -SIGUSR2 ghostty
|
||||
fi
|
||||
else
|
||||
echo "Error: foot config file not found at $CONFIG_FILE" >&2
|
||||
echo "Error: ghostty config file not found at $CONFIG_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
@@ -40,15 +45,19 @@ 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 '/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"
|
||||
# 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
|
||||
# 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"
|
||||
# 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
|
||||
# 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
|
||||
else
|
||||
echo "Error: foot config file not found at $CONFIG_FILE" >&2
|
||||
@@ -62,10 +71,15 @@ case "$APP_NAME" in
|
||||
|
||||
# Check if the config file exists.
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
# 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"
|
||||
# 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
|
||||
# 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
|
||||
else
|
||||
echo "Error: fuzzel config file not found at $CONFIG_FILE" >&2
|
||||
exit 1
|
||||
@@ -73,11 +87,10 @@ case "$APP_NAME" in
|
||||
;;
|
||||
|
||||
vicinae)
|
||||
echo "🎨 Applying 'matugen' theme to vicinae..."
|
||||
|
||||
# Apply the theme
|
||||
vicinae theme set matugen
|
||||
;;
|
||||
echo "🎨 Applying 'matugen' theme to vicinae..."
|
||||
# Apply the theme
|
||||
vicinae theme set matugen
|
||||
;;
|
||||
|
||||
pywalfox)
|
||||
echo "🎨 Updating pywalfox themes..."
|
||||
@@ -91,4 +104,4 @@ case "$APP_NAME" in
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "✅ Command sent for $APP_NAME."
|
||||
echo "✅ Command sent for $APP_NAME."
|
||||
Reference in New Issue
Block a user