1
0
mirror of https://github.com/Mayccoll/Gogh.git synced 2023-08-10 21:12:46 +03:00

Added support for Kitty

This commit is contained in:
z-nexx 2021-09-12 20:19:43 +02:00
parent 4faaf53b20
commit 851f840380
2 changed files with 72 additions and 1 deletions

View File

@ -57,6 +57,8 @@ if [[ -z "${TERMINAL:-}" ]]; then
TERMINAL=$TERM_PROGRAM
elif [[ "${OS#CYGWIN}" != "${OS}" ]]; then
TERMINAL="mintty"
elif [[ "$TERM" = "xterm-kitty" ]]; then
TERMINAL="kitty"
else
# |
# | Depending on how the script was invoked, we need
@ -118,6 +120,16 @@ case "${TERMINAL}" in
fi
;;
kitty )
if [[ -z "${KITTY_CONFIG_DIRECTORY:-}" ]]; then
KITTY_CONFIG_DIRECTORY="${HOME}/.config/kitty"
fi
CFGFILE="${KITTY_CONFIG_DIRECTORY}/kitty.conf"
if [[ ! -f "${CFGFILE}" ]]; then
printf '\n%s\n' "Error: Couldn't find an existing configuration file for Kitty."
exit 1
fi
;;
esac
@ -476,6 +488,58 @@ apply_foot() {
}
apply_kitty() {
# |
# | Applying values on Kitty
# | ===========================================
echo "Patching kitty configuration file ($CFGFILE) with include of color theme file..."
COLOR_FILE="colors.conf"
if ! grep -q "^include $COLOR_FILE$" "$CFGFILE" ; then
echo "" >> "$CFGFILE"
echo "# Added by Gogh" >> "$CFGFILE"
echo "include $COLOR_FILE" >> "$CFGFILE"
fi
CFGFILE="${KITTY_CONFIG_DIRECTORY}/$COLOR_FILE"
echo "Updating color theme file ($CFGFILE) with theme..."
rm -f "$CFGFILE"
echo "Color theme: $PROFILE_NAME" >> "$CFGFILE"
echo "Auto-generated by Gogh (https://mayccoll.github.io/Gogh/)" >> "$CFGFILE"
echo "" >> "$CFGFILE"
echo "color0 $COLOR_01" >> "$CFGFILE"
echo "color1 $COLOR_02" >> "$CFGFILE"
echo "color2 $COLOR_03" >> "$CFGFILE"
echo "color3 $COLOR_04" >> "$CFGFILE"
echo "color4 $COLOR_05" >> "$CFGFILE"
echo "color5 $COLOR_06" >> "$CFGFILE"
echo "color6 $COLOR_07" >> "$CFGFILE"
echo "color7 $COLOR_08" >> "$CFGFILE"
echo "color8 $COLOR_09" >> "$CFGFILE"
echo "color9 $COLOR_10" >> "$CFGFILE"
echo "color10 $COLOR_11" >> "$CFGFILE"
echo "color11 $COLOR_12" >> "$CFGFILE"
echo "color12 $COLOR_13" >> "$CFGFILE"
echo "color13 $COLOR_14" >> "$CFGFILE"
echo "color14 $COLOR_15" >> "$CFGFILE"
echo "color15 $COLOR_16" >> "$CFGFILE"
echo "background $BACKGROUND_COLOR" >> "$CFGFILE"
echo "foreground $FOREGROUND_COLOR" >> "$CFGFILE"
[ -n "$HIGHLIGHT_FG_COLOR " ] && echo "selection_foreground $HIGHLIGHT_FG_COLOR" >> "$CFGFILE"
[ -n "$HIGHLIGHT_BG_COLOR " ] && echo "selection_background $HIGHLIGHT_BG_COLOR" >> "$CFGFILE"
echo "cursor $CURSOR_COLOR" >> "$CFGFILE"
echo "Done - please reopen your kitty terminal to see the changes"
}
apply_darwin() {
# |
# | Applying values on iTerm2
@ -830,6 +894,10 @@ case "${TERMINAL}" in
apply_foot
;;
kitty )
apply_kitty
;;
* )
printf '%s\n' \
"Unsupported terminal!" \
@ -844,6 +912,7 @@ case "${TERMINAL}" in
" tilix" \
" xfce4-terminal" \
" foot" \
" kitty" \
"" \
"If you believe you have recieved this message in error," \
"try manually setting \`TERMINAL', hint: ps -h -o comm -p \$PPID"

View File

@ -365,6 +365,8 @@ if [[ -z "${TERMINAL:-}" ]]; then
TERMINAL=$TERM_PROGRAM
elif [[ "${OS#CYGWIN}" != "${OS}" ]]; then
TERMINAL="mintty"
elif [[ "$TERM" = "xterm-kitty" ]]; then
TERMINAL="kitty"
else
# |
# | Depending on how the script was invoked, we need