fix(macos): make Alacritty system-theme sync robust

New setup follow-up: ensure activation seeds a writable active-colors file and make theme sync always enforce the current system appearance.

Made-with: Cursor
This commit is contained in:
DannyDannyDanny 2026-03-24 10:19:41 +01:00
parent 82ce5a7fe8
commit f9edde90e4
2 changed files with 10 additions and 7 deletions

13
scripts/alacritty-sync-system-theme.sh Normal file → Executable file
View file

@ -26,15 +26,16 @@ else
want="light"
fi
if [[ -f "$MARKER" ]] && [[ "$(tr -d '\n' <"$MARKER")" == "$want" ]]; then
exit 0
fi
mkdir -p "$ALACRITTY_DIR"
printf '%s' "$want" >"$MARKER"
if [[ "$want" == "light" ]]; then
cp "$LIGHT" "$ACTIVE"
tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")"
cp "$LIGHT" "$tmp"
else
cp "$DARK" "$ACTIVE"
tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")"
cp "$DARK" "$tmp"
fi
chmod 0644 "$tmp"
mv -f "$tmp" "$ACTIVE"