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:
parent
82ce5a7fe8
commit
f9edde90e4
2 changed files with 10 additions and 7 deletions
|
|
@ -150,10 +150,12 @@
|
||||||
|
|
||||||
# Writable copy (not a symlink to the store — cp in the sync script must replace a real file).
|
# Writable copy (not a symlink to the store — cp in the sync script must replace a real file).
|
||||||
home.activation.alacrittySystemTheme = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
home.activation.alacrittySystemTheme = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
MOCHA="${config.xdg.configHome}/alacritty/catppuccin-mocha-colors.toml"
|
MOCHA="${../../../assets/alacritty/catppuccin-mocha-colors.toml}"
|
||||||
ACTIVE="${config.xdg.configHome}/alacritty/active-colors.toml"
|
ACTIVE="${config.xdg.configHome}/alacritty/active-colors.toml"
|
||||||
|
$DRY_RUN_CMD mkdir -p "${config.xdg.configHome}/alacritty"
|
||||||
if [ ! -f "$ACTIVE" ]; then
|
if [ ! -f "$ACTIVE" ]; then
|
||||||
$DRY_RUN_CMD cp "$MOCHA" "$ACTIVE"
|
$DRY_RUN_CMD cp "$MOCHA" "$ACTIVE"
|
||||||
|
$DRY_RUN_CMD chmod 0644 "$ACTIVE"
|
||||||
fi
|
fi
|
||||||
$DRY_RUN_CMD ${pkgs.bash}/bin/bash "${../../../scripts/alacritty-sync-system-theme.sh}" || true
|
$DRY_RUN_CMD ${pkgs.bash}/bin/bash "${../../../scripts/alacritty-sync-system-theme.sh}" || true
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
13
scripts/alacritty-sync-system-theme.sh
Normal file → Executable file
13
scripts/alacritty-sync-system-theme.sh
Normal file → Executable file
|
|
@ -26,15 +26,16 @@ else
|
||||||
want="light"
|
want="light"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$MARKER" ]] && [[ "$(tr -d '\n' <"$MARKER")" == "$want" ]]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$ALACRITTY_DIR"
|
mkdir -p "$ALACRITTY_DIR"
|
||||||
printf '%s' "$want" >"$MARKER"
|
printf '%s' "$want" >"$MARKER"
|
||||||
|
|
||||||
if [[ "$want" == "light" ]]; then
|
if [[ "$want" == "light" ]]; then
|
||||||
cp "$LIGHT" "$ACTIVE"
|
tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")"
|
||||||
|
cp "$LIGHT" "$tmp"
|
||||||
else
|
else
|
||||||
cp "$DARK" "$ACTIVE"
|
tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")"
|
||||||
|
cp "$DARK" "$tmp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
chmod 0644 "$tmp"
|
||||||
|
mv -f "$tmp" "$ACTIVE"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue