fix(macos): sync Neovim Catppuccin with system appearance

Write ~/.local/share/nvim_color_scheme from the same macOS Appearance probe as Alacritty; trim the nvim theme line read for robustness.

Made-with: Cursor
This commit is contained in:
DannyDannyDanny 2026-03-25 14:51:31 +01:00
parent bded1b359d
commit afbc87be2b
2 changed files with 9 additions and 1 deletions

View file

@ -16,8 +16,11 @@
local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme'
local f = io.open(config_file, "r")
if f ~= nil then
local system_theme = f:read()
local system_theme = f:read("*l")
io.close(f)
if system_theme then
system_theme = system_theme:gsub("^%s+", ""):gsub("%s+$", "")
end
if system_theme == 'dark' then
vim.cmd("set bg=dark")
elseif system_theme == 'light' then

View file

@ -29,6 +29,11 @@ fi
mkdir -p "$ALACRITTY_DIR"
printf '%s' "$want" >"$MARKER"
# Neovim (see nixos/neovim.nix): same file as `theme` on WSL; keep in sync with Appearance.
NVIM_THEME="${XDG_DATA_HOME:-$HOME/.local/share}/nvim_color_scheme"
mkdir -p "$(dirname "$NVIM_THEME")"
printf '%s\n' "$want" >"$NVIM_THEME"
if [[ "$want" == "light" ]]; then
tmp="$(mktemp "$ALACRITTY_DIR/active-colors.toml.XXXXXX")"
cp "$LIGHT" "$tmp"