From 992d4154a03514aa103c1f2ff00df57dbcf4a5c7 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 6 Apr 2021 18:37:10 +0200 Subject: [PATCH] Refactor switch-theme script --- scripts/.local/share/scripts/switch-theme | 28 +++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/scripts/.local/share/scripts/switch-theme b/scripts/.local/share/scripts/switch-theme index 69468f4..63a917f 100755 --- a/scripts/.local/share/scripts/switch-theme +++ b/scripts/.local/share/scripts/switch-theme @@ -8,20 +8,24 @@ fi mode=$1 +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 +} + +reload_kitty() { + pkill kitty + tmux source-file ~/.tmux.conf + kitty --class tmux tmux a +} + if [ "$mode" = "light" ]; then emacsclient --eval "(load-theme 'doom-nord-light 'no-confirm)" - sed -i "s/iceberg_dark/iceberg_light/" ~/.config/kitty/kitty.conf - sed -i "s/bg=dark/bg=light/" ~/.config/nvim/init.vim - sed -i "s/iceberg_dark/iceberg_light/" ~/.dotfiles/tmux/.tmux.conf - pkill kitty - tmux source-file ~/.tmux.conf - kitty --class tmux tmux a + change_theme dark light + reload_kitty else emacsclient --eval "(load-theme 'doom-nord 'no-confirm)" - sed -i "s/iceberg_light/iceberg_dark/" ~/.config/kitty/kitty.conf - sed -i "s/bg=light/bg=dark/" ~/.config/nvim/init.vim - sed -i "s/iceberg_light/iceberg_dark/" ~/.dotfiles/tmux/.tmux.conf - pkill kitty - tmux source-file ~/.tmux.conf - kitty --class tmux tmux a + change_theme light dark + reload_kitty fi