From 1671959186006ba261e28ddcb075efe9fdc1b5f8 Mon Sep 17 00:00:00 2001 From: nrand Date: Wed, 11 Mar 2026 11:58:04 +0200 Subject: [PATCH] theming: kitty theme without terminal escape codes Up until now, colors were applied with the help of terminal escape codes, ran from the fish config. This still happens (so theming will still kinda also work for other terminals), but, for kitty specifically, I've also added a way to apply the theme on startup, without the need for loading the fish config. --- dots/.config/kitty/kitty.conf | 3 +++ .../ii/scripts/colors/applycolor.sh | 22 ++++++++++++++- .../scripts/colors/terminal/kitty-theme.conf | 27 +++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 dots/.config/quickshell/ii/scripts/colors/terminal/kitty-theme.conf diff --git a/dots/.config/kitty/kitty.conf b/dots/.config/kitty/kitty.conf index 008bbbe98..97473db05 100644 --- a/dots/.config/kitty/kitty.conf +++ b/dots/.config/kitty/kitty.conf @@ -1,3 +1,6 @@ +# Theming +include ~/.local/state/quickshell/user/generated/terminal/kitty-theme.conf + # Font font_family JetBrains Mono Nerd Font font_size 11.0 diff --git a/dots/.config/quickshell/ii/scripts/colors/applycolor.sh b/dots/.config/quickshell/ii/scripts/colors/applycolor.sh index ddb93bd20..fd8651c73 100755 --- a/dots/.config/quickshell/ii/scripts/colors/applycolor.sh +++ b/dots/.config/quickshell/ii/scripts/colors/applycolor.sh @@ -27,7 +27,22 @@ IFS=$'\n' colorlist=($colornames) # Array of color names colorvalues=($colorstrings) # Array of color values -apply_term() { +apply_kitty() { + # Check if terminal escape sequence template exists + if [ ! -f "$SCRIPT_DIR/terminal/kitty-theme.conf" ]; then + echo "Template file not found for Kitty theme. Skipping that." + return + fi + # Copy template + mkdir -p "$STATE_DIR"/user/generated/terminal + cp "$SCRIPT_DIR/terminal/kitty-theme.conf" "$STATE_DIR"/user/generated/terminal/kitty-theme.conf + # Apply colors + for i in "${!colorlist[@]}"; do + sed -i "s/${colorlist[$i]} #/${colorvalues[$i]#\#}/g" "$STATE_DIR"/user/generated/terminal/kitty-theme.conf + done +} + +apply_anyterm() { # Check if terminal escape sequence template exists if [ ! -f "$SCRIPT_DIR/terminal/sequences.txt" ]; then echo "Template file not found for Terminal. Skipping that." @@ -52,6 +67,11 @@ apply_term() { done } +apply_term() { + apply_kitty + apply_anyterm +} + apply_qt() { sh "$CONFIG_DIR/scripts/kvantum/materialQT.sh" # generate kvantum theme python "$CONFIG_DIR/scripts/kvantum/changeAdwColors.py" # apply config colors diff --git a/dots/.config/quickshell/ii/scripts/colors/terminal/kitty-theme.conf b/dots/.config/quickshell/ii/scripts/colors/terminal/kitty-theme.conf new file mode 100644 index 000000000..2017b50f6 --- /dev/null +++ b/dots/.config/quickshell/ii/scripts/colors/terminal/kitty-theme.conf @@ -0,0 +1,27 @@ +background #$term0 # + +color0 #$term0 # +color1 #$term1 # +color2 #$term2 # +color3 #$term3 # +color4 #$term4 # +color5 #$term5 # +color6 #$term6 # +color7 #$term7 # +color8 #$term8 # +color9 #$term9 # +color10 #$term10 # +color11 #$term11 # +color12 #$term12 # +color13 #$term13 # +color14 #$term14 # +color15 #$term15 # + +color232 #$term7 # + +cursor #$term7 # + +foreground #$term7 # + +selection_background #$term7 # +selection_foreground #$term0 #