Recolor zathura in switch-theme

This commit is contained in:
2022-05-02 14:03:22 +02:00
parent 5232b8a3e9
commit c4156d2080
4 changed files with 24 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ fi
mode=$1
capitalize() {
printf '%s' "$1" | head -c 1 | tr [:lower:] [:upper:]
printf '%s' "$1" | head -c 1 | tr "[:lower:]" "[:upper:]"
printf '%s' "$1" | tail -c '+2'
}
@@ -17,14 +17,27 @@ change_theme() {
sed -i "s/iceberg_$1/iceberg_$2/" ~/.config/kitty/kitty.conf
sed -i "s/bg=$1/bg=$2/" ~/.config/nvim/init.vim
sed -i "s/iceberg_$1/iceberg_$2/" ~/.dotfiles/tmux/.tmux.conf
sed -i "s/iceberg_$1/iceberg_$2/" ~/.config/zathura/zathurarc
kitty +kitten themes --reload-in=all "Iceberg $(capitalize "$2")"
tmux source-file ~/.tmux.conf
}
recolor_zathura() {
instances=$(pgrep -f zathura)
temp_file=/tmp/zathura-instances
echo "$instances" >"$temp_file"
while IFS= read -r line; do
dbus-send --type="method_call" --dest=org.pwmt.zathura.PID-"$line" \
/org/pwmt/zathura org.pwmt.zathura.ExecuteCommand string:"source"
done <"$temp_file"
}
if [ "$mode" = "light" ]; then
emacsclient --eval "(load-theme 'doom-nord-light 'no-confirm)"
change_theme dark light
recolor_zathura
else
emacsclient --eval "(load-theme 'doom-nord 'no-confirm)"
change_theme light dark
recolor_zathura
fi