Last active
January 24, 2024 04:14
-
-
Save apolopena/950eb50c599c8135d1e5424dc84ba45b to your computer and use it in GitHub Desktop.
swap_kitty_theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function: swap_kitty_theme | |
# Pass in a Kitty Terminal theme .conf and it will be written to $HOME/.config/kitty/current_colors.conf | |
# Kitty's configuration will be reloaded automagically | |
# Assumes you have the following line in your $HOME/.config/kitty/kitty.conf | |
# include current_colors.conf | |
# Example: alias k-theme-monalisa="swap_kitty_theme 'Mona Lisa.conf'" | |
function swap_kitty_theme() { | |
local base="$HOME/.config/kitty/" | |
local colors="${base}current_colors.conf" | |
local theme="${base}$1" | |
local theme_name="${base}current_theme_colors" | |
[ ! -f $colors ] && touch "${colors}" | |
if [ ! -f $theme ]; then | |
echo "Error: Kitty theme not found at ${theme}" | |
return 1 | |
fi | |
cat "${theme}" > "${colors}" && echo "$1" > "${theme_name}" && kill -SIGUSR1 $KITTY_PID && | |
echo "Success: ${theme} written to ${colors}" && cat "${theme_name}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment