Refactor switch-theme using kitty theme-switcher

This commit is contained in:
coolneng 2022-05-02 12:44:06 +02:00
parent 80e5f3e090
commit cb6d36b983
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
5 changed files with 24 additions and 26 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ gpg/.gnupg/**
!gpg/.gnupg/gpg-agent.conf !gpg/.gnupg/gpg-agent.conf
beets/.config/beets/** beets/.config/beets/**
!beets/.config/beets/config.yaml !beets/.config/beets/config.yaml
kitty/.config/kitty/current-theme.conf

View File

@ -73,12 +73,10 @@ box_drawing_scale 0.001, 1, 1.5, 2
#: }}} #: }}}
#: Cursor customization {{{ #: Cursor customization {{{
# cursor #cccccc
cursor #cccccc
#: Default cursor color #: Default cursor color
# cursor_text_color #111111
cursor_text_color #111111
#: Choose the color of text under the cursor. If you want it rendered #: Choose the color of text under the cursor. If you want it rendered
#: with the background color of the cell underneath instead, use the #: 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. #: mouse not being used. Set to zero to disable mouse cursor hiding.
#: Set to a negative value to hide the mouse cursor immediately when #: Set to a negative value to hide the mouse cursor immediately when
#: typing text. #: typing text.
# url_color #0087bd
url_color #0087bd
url_style curly url_style curly
#: The color and style for highlighting URLs on mouse-over. url_style #: 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 #: 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 #: placed centrally. A value of top-left means the padding will be on
#: only the bottom and right edges. #: 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 #: The color for the border of the active window. Set this to none to
#: not draw borders around the active window. #: not draw borders around the active window.
# inactive_border_color #cccccc
inactive_border_color #cccccc
#: The color for the border of inactive windows #: 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 #: The color for the border of inactive windows in which a bell has
#: occurred #: occurred
@ -445,12 +439,11 @@ tab_title_template {title}
#: title. If you wish to include the tab-index as well, use something #: title. If you wish to include the tab-index as well, use something
#: like: {index}: {title}. Useful if you have shortcuts mapped for #: like: {index}: {title}. Useful if you have shortcuts mapped for
#: goto_tab N. #: goto_tab N.
# active_tab_foreground #000
active_tab_foreground #000 # active_tab_background #eee
active_tab_background #eee
active_tab_font_style bold-italic active_tab_font_style bold-italic
inactive_tab_foreground #444 # inactive_tab_foreground #444
inactive_tab_background #999 # inactive_tab_background #999
inactive_tab_font_style normal inactive_tab_font_style normal
#: Tab bar colors and styles #: Tab bar colors and styles
@ -583,8 +576,7 @@ term xterm-kitty
#: }}} #: }}}
#: OS specific tweaks {{{ #: OS specific tweaks {{{
# macos_titlebar_color system
macos_titlebar_color system
#: Change the color of the kitty window's titlebar on macOS. A value #: 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 #: 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

View File

@ -8,24 +8,23 @@ fi
mode=$1 mode=$1
capitalize() {
printf '%s' "$1" | head -c 1 | tr [:lower:] [:upper:]
printf '%s' "$1" | tail -c '+2'
}
change_theme() { change_theme() {
sed -i "s/iceberg_$1/iceberg_$2/" ~/.config/kitty/kitty.conf 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/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/" ~/.dotfiles/tmux/.tmux.conf
} kitty +kitten themes --reload-in=all "Iceberg $(capitalize "$2")"
reload_kitty() {
pkill kitty
tmux source-file ~/.tmux.conf tmux source-file ~/.tmux.conf
kitty --class tmux tmux a
} }
if [ "$mode" = "light" ]; then if [ "$mode" = "light" ]; then
emacsclient --eval "(load-theme 'doom-nord-light 'no-confirm)" emacsclient --eval "(load-theme 'doom-nord-light 'no-confirm)"
change_theme dark light change_theme dark light
reload_kitty
else else
emacsclient --eval "(load-theme 'doom-nord 'no-confirm)" emacsclient --eval "(load-theme 'doom-nord 'no-confirm)"
change_theme light dark change_theme light dark
reload_kitty
fi fi