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