(bash) update terminal theme logic

copy theme file instead of creating a symlink
forces alacritty to reload in some linux distros such as ubuntu and
fedora
for some reason removing/creating a new symlink does not trigger the
live reload of alacritty
This commit is contained in:
jc 2024-11-17 13:25:01 -05:00
commit 086369252f

View file

@ -295,25 +295,26 @@ export TERM_COLOR_MODE
# set the terminal color theme
USE_TERM=alacritty
if [ $TERM_COLOR_MODE == "light" ]; then
if [ $USE_TERM == "kitty" ]; then
kitten @ set-colors --all "$HOME/.config/kitty/light.conf"
fi
if [ $USE_TERM == "alacritty" ]; then
theme_link="$HOME/.config/alacritty/theme.toml"
rm -rf "$theme_link"
ln -s "$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_latte.toml" "$theme_link"
fi
else
if [ $USE_TERM == "kitty" ]; then
kitten @ set-colors --all "$HOME/.config/kitty/dark.conf"
fi
if [ $USE_TERM == "alacritty" ]; then
theme_link="$HOME/.config/alacritty/theme.toml"
rm -r "$theme_link"
ln -s "$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_mocha.toml" "$theme_link"
fi
theme_link="$HOME/.config/alacritty/theme.toml"
use_theme="$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_latte.toml"
if [ $TERM_COLOR_MODE == "dark" ]; then
# if [ $USE_TERM == "kitty" ]; then
# kitten @ set-colors --all "$HOME/.config/kitty/light.conf"
# fi
# if [ $USE_TERM == "alacritty" ]; then
# cp "$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_latte.toml" "$theme_link"
# fi
use_theme="$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_mocha.toml"
# else
# if [ $USE_TERM == "kitty" ]; then
# kitten @ set-colors --all "$HOME/.config/kitty/dark.conf"
# fi
# if [ $USE_TERM == "alacritty" ]; then
# cp "$HOME/ghq/alacritty/alacritty-theme/themes/catppuccin_mocha.toml" "$theme_link"
# fi
fi
rm -f "$theme_link"
cp "$use_theme" "$theme_link"
# setup kitty, it will export TERM_COLOR_MODE (can be light or dark)
# source ~/.config/kitty/setup.sh