mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
add kitty patcher
This commit is contained in:
parent
5bce862d86
commit
1bb21839be
5 changed files with 124 additions and 1 deletions
|
@ -28,5 +28,5 @@ done
|
|||
|
||||
# Kitty
|
||||
file_name=kitty.conf
|
||||
file_path="$DOTFILES_PATH/$file_name"
|
||||
file_path="$DOTFILES_PATH/kitty/$file_name"
|
||||
install_dotfile "$HOME/.config/kitty/$file_name" "include ${(q)file_path}"
|
||||
|
|
1
kitty/.gitignore
vendored
Normal file
1
kitty/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/src
|
63
kitty/install.sh
Executable file
63
kitty/install.sh
Executable file
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
shopt -s nullglob
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
ansi_reset="$(tput sgr0)"
|
||||
ansi_bold="$(tput bold)"
|
||||
ansi_rev="$(tput rev)"
|
||||
log() {
|
||||
echo >&2 "${ansi_bold}${ansi_rev}[$0]${ansi_reset}" "$@"
|
||||
}
|
||||
|
||||
mkdir -p src
|
||||
cd src
|
||||
|
||||
log "fetching release information"
|
||||
eval "$(
|
||||
curl --show-error --fail https://api.github.com/repos/kovidgoyal/kitty/releases/latest |
|
||||
jq --raw-output '
|
||||
"release_version=" + (.name | sub("^version "; "") | @sh) + "\n" + (
|
||||
.assets | map(select(.label == "Source code")) | first |
|
||||
"release_src_filename=" + (.name | @sh) + "\n" +
|
||||
"release_src_url=" + (.browser_download_url | @sh)
|
||||
)
|
||||
'
|
||||
)"
|
||||
if [ -z "$release_version" ]; then
|
||||
log "couldn't parse response from GitHub API"
|
||||
exit 1
|
||||
fi
|
||||
log "the latest version is $release_version"
|
||||
|
||||
if [ ! -f "$release_src_filename" ]; then
|
||||
log "downloading $release_src_filename from $release_src_url"
|
||||
curl --show-error --fail --location "$release_src_url" -o "$release_src_filename"
|
||||
else
|
||||
log "$release_src_filename had already downloaded"
|
||||
fi
|
||||
|
||||
release_src_dir="${release_src_filename%.tar.xz}"
|
||||
if [ -d "$release_src_dir" ]; then
|
||||
log "clearing previous source code directory"
|
||||
rm -r "$release_src_dir"
|
||||
fi
|
||||
|
||||
log "unpacking source code archive to src/$release_src_dir"
|
||||
tar --xz -xf "$release_src_filename"
|
||||
cd "$release_src_dir"
|
||||
|
||||
log "patching"
|
||||
for patch in ../../patches/*.patch; do
|
||||
log "applying patch $patch"
|
||||
patch --unified --strip 0 < "$patch"
|
||||
done
|
||||
|
||||
log "compiling"
|
||||
case "$OSTYPE" in
|
||||
darwin*) make app ;;
|
||||
linux*) python3 setup.py linux-package ;;
|
||||
*) log "error: compilation on $OSTYPE is not supported"; exit 1 ;;
|
||||
esac
|
|
@ -331,6 +331,8 @@ tab_separator " │ "
|
|||
#: The separator between tabs in the tab bar when using separator as
|
||||
#: the tab_bar_style.
|
||||
|
||||
tab_bar_min_tabs 1
|
||||
|
||||
# active_tab_foreground #000
|
||||
# active_tab_background #eee
|
||||
active_tab_font_style bold
|
57
kitty/patches/tab_title.patch
Normal file
57
kitty/patches/tab_title.patch
Normal file
|
@ -0,0 +1,57 @@
|
|||
--- kitty/tab_bar.py 2019-06-09 11:10:02.000000000 +0300
|
||||
+++ kitty/tab_bar.py 2019-06-09 17:50:11.605996845 +0300
|
||||
@@ -25,7 +25,7 @@
|
||||
return (x << 8) | 2
|
||||
|
||||
|
||||
-def draw_title(draw_data, screen, tab, index):
|
||||
+def draw_title(draw_data, screen, tab, index, max_title_text_length):
|
||||
if tab.needs_attention and draw_data.bell_on_tab:
|
||||
fg = screen.cursor.fg
|
||||
screen.cursor.fg = draw_data.bell_fg
|
||||
@@ -38,19 +38,20 @@
|
||||
draw_title.template_failure_reported = True
|
||||
log_error('Invalid tab title template: "{}" with error: {}'.format(draw_data.title_template, e))
|
||||
title = tab.title
|
||||
+ extra = len(title) - max_title_text_length
|
||||
+ if extra > 0:
|
||||
+ title = '…' + title[1 + extra:]
|
||||
screen.draw(title)
|
||||
+ return extra
|
||||
|
||||
|
||||
def draw_tab_with_separator(draw_data, screen, tab, before, max_title_length, index):
|
||||
if draw_data.leading_spaces:
|
||||
screen.draw(' ' * draw_data.leading_spaces)
|
||||
- draw_title(draw_data, screen, tab, index)
|
||||
+ max_title_text_length = max_title_length - draw_data.leading_spaces - draw_data.trailing_spaces
|
||||
+ draw_title(draw_data, screen, tab, index, max_title_text_length)
|
||||
trailing_spaces = min(max_title_length - 1, draw_data.trailing_spaces)
|
||||
max_title_length -= trailing_spaces
|
||||
- extra = screen.cursor.x - before - max_title_length
|
||||
- if extra > 0:
|
||||
- screen.cursor.x -= extra + 1
|
||||
- screen.draw('…')
|
||||
if trailing_spaces:
|
||||
screen.draw(' ' * trailing_spaces)
|
||||
end = screen.cursor.x
|
||||
@@ -66,15 +67,12 @@
|
||||
for bg in fade_colors:
|
||||
screen.cursor.bg = bg
|
||||
screen.draw(' ')
|
||||
- draw_title(draw_data, screen, tab, index)
|
||||
- extra = screen.cursor.x - before - max_title_length
|
||||
+ max_title_text_length = max_title_length - len(fade_colors) * 2
|
||||
+ extra = draw_title(draw_data, screen, tab, index, max_title_text_length)
|
||||
if extra > 0:
|
||||
screen.cursor.x = before
|
||||
- draw_title(draw_data, screen, tab, index)
|
||||
- extra = screen.cursor.x - before - max_title_length
|
||||
- if extra > 0:
|
||||
- screen.cursor.x -= extra + 1
|
||||
- screen.draw('…')
|
||||
+ max_title_text_length = max_title_length
|
||||
+ extra = draw_title(draw_data, screen, tab, index, max_title_text_length)
|
||||
for bg in reversed(fade_colors):
|
||||
if extra >= 0:
|
||||
break
|
Loading…
Reference in a new issue