From c1fce985b8bf5955136a1bef8fbd3cff9324e1a0 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Fri, 16 Aug 2024 10:23:41 +0200 Subject: [PATCH] alacritty: add script to adjust alacritty theme based on macOS dark/light mode setting --- bin/alacritty-toggle.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 bin/alacritty-toggle.sh diff --git a/bin/alacritty-toggle.sh b/bin/alacritty-toggle.sh new file mode 100755 index 0000000..dea8367 --- /dev/null +++ b/bin/alacritty-toggle.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# +# Adjusts Alacritty color scheme to match macOS dark/light mode setting + +mode=$(defaults read -g AppleInterfaceStyle 2>/dev/null || echo "Light") +alacritty_config=~/.config/alacritty/alacritty.toml + +if [ "$mode" = "Dark" ]; then + sed -i '' "s#tokyonight_day.toml#tokyonight_moon.toml#" $alacritty_config +else + sed -i '' "s#tokyonight_moon.toml#tokyonight_day.toml#" $alacritty_config +fi