Matugen: Adjust cava's posthook

This commit is contained in:
Aiser
2025-11-24 02:23:21 +08:00
parent 33af5b9ab9
commit 002df77b78
2 changed files with 38 additions and 2 deletions
+37 -1
View File
@@ -4,7 +4,7 @@
if [ "$#" -ne 1 ]; then
# Print usage information to standard error.
echo "Error: No application specified." >&2
echo "Usage: $0 {kitty|ghostty|foot|alacritty|wezterm|fuzzel|walker|pywalfox}" >&2
echo "Usage: $0 {kitty|ghostty|foot|alacritty|wezterm|fuzzel|walker|pywalfox|cava}" >&2
exit 1
fi
@@ -200,6 +200,42 @@ pywalfox)
pywalfox update
;;
cava)
echo "🎨 Applying 'noctalia' theme to cava..."
CONFIG_FILE="$HOME/.config/cava/config"
# Check if the config file exists.
if [ -f "$CONFIG_FILE" ]; then
# Check if [color] section exists
if grep -q '^\[color\]' "$CONFIG_FILE"; then
echo "[color] section found, checking theme setting..."
# Check if theme is already set to noctalia under [color]
if sed -n '/^\[color\]/,/^\[/p' "$CONFIG_FILE" | grep -q '^theme = "noctalia"'; then
echo "Theme already set to noctalia under [color], skipping modification."
else
# Check if theme line exists under [color] section
if sed -n '/^\[color\]/,/^\[/p' "$CONFIG_FILE" | grep -q '^theme = '; then
# Replace existing theme line under [color]
sed -i '/^\[color\]/,/^\[/{s/^theme = .*/theme = "noctalia"/}' "$CONFIG_FILE"
else
# Add theme line after [color]
sed -i '/^\[color\]/a theme = "noctalia"' "$CONFIG_FILE"
fi
fi
else
echo "[color] section not found, adding it with theme..."
# Add [color] section with theme at the end of file
echo "" >>"$CONFIG_FILE"
echo "[color]" >>"$CONFIG_FILE"
echo 'theme = "noctalia"' >>"$CONFIG_FILE"
fi
else
echo "Error: cava config file not found at $CONFIG_FILE" >&2
exit 1
fi
;;
*)
# Handle unknown application names.
echo "Error: Unknown application '$APP_NAME'." >&2
+1 -1
View File
@@ -219,7 +219,7 @@ Singleton {
"path": "~/.config/cava/themes/noctalia"
}
],
"postProcess": () => `pkill -USR1 cava`
"postProcess": () => `${colorsApplyScript} cava`
}
]