Fix AGS colors.css generation for Omarchy 4 colors.toml

Claude-Session: https://claude.ai/code/session_014ADhvRXuiTvrXSbConxUey
This commit is contained in:
2026-08-19 14:05:26 -04:00
parent 5780242068
commit 69be9e2552
+11 -3
View File
@@ -2,10 +2,18 @@
THEME_NAME=$1 THEME_NAME=$1
echo "Theme changed to: $THEME_NAME" echo "Theme changed to: $THEME_NAME"
# Generate AGS colors from Omarchy theme colors.toml COLORS_FILE="$HOME/.local/state/omarchy/current/theme/colors.toml"
awk -F '=' 'NF==2 { gsub(/"/,"",$2); gsub(/ /,"",$1); gsub(/ /,"",$2); print "@define-color " $1 " " $2 ";" }' ~/.local/state/omarchy/current/theme/colors.toml > ~/.config/ags/colors.css AGS_COLORS_FILE="$HOME/.config/ags/colors.css"
# Only hex values become GTK colors: colors.toml also carries non-color keys
# such as `mode`, and @define-color rejects them. omarchy-theme-color resolves
# the legacy color0..color15 aliases that ags/style.css still uses.
if command -v omarchy-theme-color &> /dev/null; then
omarchy-theme-color --file "$COLORS_FILE" --all
else
awk -F '=' 'NF==2 { gsub(/"/,"",$2); gsub(/ /,"",$1); gsub(/ /,"",$2); print $1 "\t" $2 }' "$COLORS_FILE"
fi | awk -F '\t' '$2 ~ /^#/ { print "@define-color " $1 " " $2 ";" }' > "$AGS_COLORS_FILE"
# Restart AGS to apply new theme colors
if command -v ags &> /dev/null; then if command -v ags &> /dev/null; then
ags quit >/dev/null 2>&1 || true ags quit >/dev/null 2>&1 || true
sleep 0.5 sleep 0.5