feat(macos): Alacritty follows system light/dark appearance
New setup — due for review after you run darwin-rebuild switch and live with it for a few days. See CLAUDE.md (Alacritty) and assets/alacritty/README.md. - HM: import active-colors.toml + Catppuccin latte/mocha fragments - nix-darwin: launchd.user.agents.alacritty-system-theme + PATH helper - fish: background sync on Darwin; theme.sh no longer rebuilds for Alacritty - Remove switch-alacritty-theme.sh (sed + darwin-rebuild per toggle) Made-with: Cursor
This commit is contained in:
parent
18ccebc109
commit
b311e21d5b
15 changed files with 196 additions and 293 deletions
40
scripts/alacritty-sync-system-theme.sh
Normal file
40
scripts/alacritty-sync-system-theme.sh
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env bash
|
||||
# Keep Alacritty in sync with macOS light/dark appearance.
|
||||
# No Nix rebuild: copies a palette into active-colors.toml; Alacritty reloads via live_config_reload.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
[[ "$(uname -s)" == "Darwin" ]] || exit 0
|
||||
|
||||
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
ALACRITTY_DIR="$XDG_CONFIG_HOME/alacritty"
|
||||
ACTIVE="$ALACRITTY_DIR/active-colors.toml"
|
||||
MARKER="$ALACRITTY_DIR/.last-system-theme"
|
||||
|
||||
LIGHT="$ALACRITTY_DIR/catppuccin-latte-colors.toml"
|
||||
DARK="$ALACRITTY_DIR/catppuccin-mocha-colors.toml"
|
||||
|
||||
if [[ ! -f "$LIGHT" || ! -f "$DARK" ]]; then
|
||||
echo "alacritty-sync-system-theme: missing $LIGHT or $DARK (run home-manager switch first)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
appearance="$(defaults read -g AppleInterfaceStyle 2>/dev/null || true)"
|
||||
if [[ "$appearance" == "Dark" ]]; then
|
||||
want="dark"
|
||||
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"
|
||||
else
|
||||
cp "$DARK" "$ACTIVE"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue