From cb6d36b9832aedddafe6c4405e6642c421c2792f Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 2 May 2022 12:44:06 +0200 Subject: [PATCH] Refactor switch-theme using kitty theme-switcher --- .gitignore | 1 + kitty/.config/kitty/kitty.conf | 36 +++++++++---------- .../kitty/{ => themes}/iceberg_dark.conf | 0 .../kitty/{ => themes}/iceberg_light.conf | 0 scripts/.local/share/scripts/switch-theme | 13 ++++--- 5 files changed, 24 insertions(+), 26 deletions(-) rename kitty/.config/kitty/{ => themes}/iceberg_dark.conf (100%) rename kitty/.config/kitty/{ => themes}/iceberg_light.conf (100%) diff --git a/.gitignore b/.gitignore index b6028ce..124c571 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ gpg/.gnupg/** !gpg/.gnupg/gpg-agent.conf beets/.config/beets/** !beets/.config/beets/config.yaml +kitty/.config/kitty/current-theme.conf diff --git a/kitty/.config/kitty/kitty.conf b/kitty/.config/kitty/kitty.conf index aebf8d5..a023eef 100644 --- a/kitty/.config/kitty/kitty.conf +++ b/kitty/.config/kitty/kitty.conf @@ -73,12 +73,10 @@ box_drawing_scale 0.001, 1, 1.5, 2 #: }}} #: Cursor customization {{{ - -cursor #cccccc +# cursor #cccccc #: Default cursor color - -cursor_text_color #111111 +# cursor_text_color #111111 #: Choose the color of text under the cursor. If you want it rendered #: with the background color of the cell underneath instead, use the @@ -154,8 +152,7 @@ mouse_hide_wait 3.0 #: mouse not being used. Set to zero to disable mouse cursor hiding. #: Set to a negative value to hide the mouse cursor immediately when #: typing text. - -url_color #0087bd +# url_color #0087bd url_style curly #: The color and style for highlighting URLs on mouse-over. url_style @@ -354,17 +351,14 @@ placement_strategy center #: this option. Using a value of center means the cell area will be #: placed centrally. A value of top-left means the padding will be on #: only the bottom and right edges. - -active_border_color #00ff00 +# active_border_color #00ff00 #: The color for the border of the active window. Set this to none to #: not draw borders around the active window. - -inactive_border_color #cccccc +# inactive_border_color #cccccc #: The color for the border of inactive windows - -bell_border_color #ff5a00 +# bell_border_color #ff5a00 #: The color for the border of inactive windows in which a bell has #: occurred @@ -445,12 +439,11 @@ tab_title_template {title} #: title. If you wish to include the tab-index as well, use something #: like: {index}: {title}. Useful if you have shortcuts mapped for #: goto_tab N. - -active_tab_foreground #000 -active_tab_background #eee +# active_tab_foreground #000 +# active_tab_background #eee active_tab_font_style bold-italic -inactive_tab_foreground #444 -inactive_tab_background #999 +# inactive_tab_foreground #444 +# inactive_tab_background #999 inactive_tab_font_style normal #: Tab bar colors and styles @@ -583,8 +576,7 @@ term xterm-kitty #: }}} #: OS specific tweaks {{{ - -macos_titlebar_color system +# macos_titlebar_color system #: Change the color of the kitty window's titlebar on macOS. A value #: of system means to use the default system color, a value of @@ -999,3 +991,9 @@ map kitty_mod+delete clear_terminal reset active #: }}} # }}} + + +# BEGIN_KITTY_THEME +# Iceberg Dark +include current-theme.conf +# END_KITTY_THEME \ No newline at end of file diff --git a/kitty/.config/kitty/iceberg_dark.conf b/kitty/.config/kitty/themes/iceberg_dark.conf similarity index 100% rename from kitty/.config/kitty/iceberg_dark.conf rename to kitty/.config/kitty/themes/iceberg_dark.conf diff --git a/kitty/.config/kitty/iceberg_light.conf b/kitty/.config/kitty/themes/iceberg_light.conf similarity index 100% rename from kitty/.config/kitty/iceberg_light.conf rename to kitty/.config/kitty/themes/iceberg_light.conf diff --git a/scripts/.local/share/scripts/switch-theme b/scripts/.local/share/scripts/switch-theme index 63a917f..7c86f0c 100755 --- a/scripts/.local/share/scripts/switch-theme +++ b/scripts/.local/share/scripts/switch-theme @@ -8,24 +8,23 @@ fi mode=$1 +capitalize() { + printf '%s' "$1" | head -c 1 | tr [:lower:] [:upper:] + printf '%s' "$1" | tail -c '+2' +} + 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 + kitty +kitten themes --reload-in=all "Iceberg $(capitalize "$2")" tmux source-file ~/.tmux.conf - kitty --class tmux tmux a } if [ "$mode" = "light" ]; then emacsclient --eval "(load-theme 'doom-nord-light 'no-confirm)" change_theme dark light - reload_kitty else emacsclient --eval "(load-theme 'doom-nord 'no-confirm)" change_theme light dark - reload_kitty fi