init
This commit is contained in:
3
kitty/.github/README.md
vendored
Normal file
3
kitty/.github/README.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<div align="center">
|
||||
<a href=""><img src="./title.png"></a>
|
||||
</div>
|
||||
BIN
kitty/.github/title.png
vendored
Normal file
BIN
kitty/.github/title.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
3
kitty/kitty-open-helper.sh
Normal file
3
kitty/kitty-open-helper.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
[ "$1" = @selection ] && set -- .
|
||||
xdg-open "$1"
|
||||
142
kitty/kitty.conf
Normal file
142
kitty/kitty.conf
Normal file
@@ -0,0 +1,142 @@
|
||||
# Font
|
||||
|
||||
font_family MesloLGS NF Regular
|
||||
bold_font MesloLGS NF Bold
|
||||
italic_font MesloLGS NF Italic
|
||||
bold_italic_font MesloLGS NF Medium Italic
|
||||
font_size 10.5
|
||||
modify_font cell_height 122%
|
||||
|
||||
# Theme
|
||||
include themes/catppuccin-macchiato.conf
|
||||
|
||||
# Window layout
|
||||
enabled_layouts *
|
||||
window_resize_step_cells 2
|
||||
window_resize_step_lines 2
|
||||
window_border_width 1pt
|
||||
window_margin_width 0
|
||||
single_window_margin_width -1
|
||||
window_padding_width 12
|
||||
|
||||
# Tab bar
|
||||
tab_bar_edge bottom
|
||||
tab_bar_margin_width 0.0
|
||||
tab_bar_margin_height 0.0 0.0
|
||||
tab_bar_style powerline
|
||||
tab_bar_align left
|
||||
tab_bar_min_tabs 2
|
||||
tab_switch_strategy previous
|
||||
tab_fade 0.25 0.5 0.75 1
|
||||
tab_separator " ┇"
|
||||
tab_powerline_style slanted
|
||||
tab_activity_symbol none
|
||||
tab_title_template "{f'{title[:30]}…' if title.rindex(title[-1]) + 1 > 30 else (title.center(6) if (title.rindex(title[-1]) + 1) % 2 == 0 else title.center(5))}"
|
||||
active_tab_title_template none
|
||||
active_tab_font_style bold-italic
|
||||
inactive_tab_font_style normal
|
||||
|
||||
# Background
|
||||
# background_opacity 0.95
|
||||
|
||||
# Other
|
||||
shell zsh
|
||||
editor vim
|
||||
allow_remote_control yes
|
||||
listen_on unix:@mykitty
|
||||
allow_hyperlinks yes
|
||||
shell_integration enabled
|
||||
confirm_os_window_close 0
|
||||
cursor_trail 0
|
||||
cursor_trail_decay 0.1 0.2
|
||||
cursor_trail_start_threshold 4
|
||||
|
||||
|
||||
# Keybindings
|
||||
kitty_mod ctrl+shift
|
||||
|
||||
# Scrolling
|
||||
map kitty_mod+up scroll_line_up
|
||||
map opt+cmd+page_up scroll_line_up
|
||||
map cmd+up scroll_line_up
|
||||
|
||||
map kitty_mod+down scroll_line_down
|
||||
map opt+cmd+page_down scroll_line_down
|
||||
map cmd+down scroll_line_down
|
||||
|
||||
map kitty_mod+k scroll_page_up
|
||||
map cmd+page_up scroll_page_up
|
||||
|
||||
map kitty_mod+j scroll_page_down
|
||||
map cmd+page_down scroll_page_down
|
||||
|
||||
map kitty_mod+home scroll_home
|
||||
map cmd+home scroll_home
|
||||
|
||||
map kitty_mod+end scroll_end
|
||||
map cmd+end scroll_end
|
||||
|
||||
map kitty_mod+z scroll_to_prompt -1
|
||||
|
||||
# Window management
|
||||
map kitty_mod+enter new_window
|
||||
map cmd+enter new_window
|
||||
|
||||
map ctrl+alt+enter launch --cwd=current
|
||||
|
||||
map kitty_mod+] next_window
|
||||
map kitty_mod+[ previous_window
|
||||
|
||||
map kitty_mod+f move_window_forward
|
||||
map kitty_mod+b move_window_backward
|
||||
|
||||
# Tab management
|
||||
map kitty_mod+right next_tab
|
||||
map shift+cmd+] next_tab
|
||||
map ctrl+tab next_tab
|
||||
|
||||
map kitty_mod+left previous_tab
|
||||
map shift+cmd+[ previous_tab
|
||||
map ctrl+shift+tab previous_tab
|
||||
|
||||
map kitty_mod+t new_tab
|
||||
map cmd+t new_tab
|
||||
|
||||
map kitty_mod+q close_tab
|
||||
map cmd+w close_tab
|
||||
|
||||
map kitty_mod+. move_tab_forward
|
||||
map kitty_mod+, move_tab_backward
|
||||
|
||||
map kitty_mod+n set_tab_title
|
||||
|
||||
# Layout management
|
||||
map kitty_mod+l next_layout
|
||||
|
||||
# Font sizes
|
||||
map kitty_mod+equal change_font_size all +1.0
|
||||
map kitty_mod+plus change_font_size all +1.0
|
||||
map kitty_mod+kp_add change_font_size all +1.0
|
||||
map cmd+plus change_font_size all +1.0
|
||||
map cmd+equal change_font_size all +1.0
|
||||
map shift+cmd+equal change_font_size all +1.0
|
||||
|
||||
map kitty_mod+minus change_font_size all -1.0
|
||||
map kitty_mod+kp_subtract change_font_size all -1.0
|
||||
map cmd+minus change_font_size all -1.0
|
||||
map shift+cmd+minus change_font_size all -1.0
|
||||
|
||||
map kitty_mod+backspace change_font_size all 0
|
||||
map cmd+0 change_font_size all 0
|
||||
|
||||
|
||||
# Others
|
||||
map kitty_mod+e launch --type=background --cwd=current sh -c 'hyprctl dispatch exec "[float; size 60% 60%; center 1] xdg-open" $(pwd)'
|
||||
map kitty_mod+u launch --type=background --cwd=current sh -c 'vscodium $(pwd)'
|
||||
map kitty_mod+y launch --type=overlay-main --cwd=current yazi
|
||||
|
||||
map kitty_mod+f5 load_config_file
|
||||
action_alias kitty_scrollback_nvim kitten ~/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py
|
||||
# action_alias kitty_scrollback_nvim kitten ~/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --nvim-args --clean
|
||||
map kitty_mod+h kitty_scrollback_nvim
|
||||
map kitty_mod+g kitty_scrollback_nvim --config ksb_builtin_last_cmd_output
|
||||
35
kitty/neighboring_window.py
Normal file
35
kitty/neighboring_window.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from kitty.key_encoding import KeyEvent, parse_shortcut
|
||||
from kittens.tui.handler import result_handler
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
|
||||
|
||||
def encode_key_mapping(window, key_mapping):
|
||||
mods, key = parse_shortcut(key_mapping)
|
||||
event = KeyEvent(
|
||||
mods=mods,
|
||||
key=key,
|
||||
shift=bool(mods & 1),
|
||||
alt=bool(mods & 2),
|
||||
ctrl=bool(mods & 4),
|
||||
super=bool(mods & 8),
|
||||
hyper=bool(mods & 16),
|
||||
meta=bool(mods & 32),
|
||||
).as_window_system_event()
|
||||
|
||||
return window.encoded_key(event)
|
||||
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(args, result, target_window_id, boss):
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
|
||||
cmd = window.child.foreground_cmdline[0]
|
||||
if cmd == 'tmux':
|
||||
keymap = args[2]
|
||||
encoded = encode_key_mapping(window, keymap)
|
||||
window.write_to_child(encoded)
|
||||
else:
|
||||
boss.active_tab.neighboring_window(args[1])
|
||||
31
kitty/open-actions.conf
Normal file
31
kitty/open-actions.conf
Normal file
@@ -0,0 +1,31 @@
|
||||
# Directories
|
||||
protocol file
|
||||
mime inode/directory
|
||||
xdg-open --type=os-window --cwd $FILE_PATH
|
||||
|
||||
# Files
|
||||
protocol file
|
||||
mime text/*
|
||||
action launch --type=overlay $EDITOR $FILE_PATH
|
||||
|
||||
# Images
|
||||
protocol file
|
||||
mime image/*
|
||||
xdg-open $FILE_PATH
|
||||
|
||||
# SSH Urls
|
||||
protocol ssh
|
||||
action launch --type=os-window ssh $URL
|
||||
|
||||
# Executables
|
||||
action launch --hold --type=os-window $FILE_PATH
|
||||
|
||||
# Shell files
|
||||
protocol file
|
||||
ext fish,bash,zsh
|
||||
action launch --hold --type=os-window kitty +shebang $FILE_PATH __ext__
|
||||
|
||||
# Scripts
|
||||
protocol file
|
||||
ext sh,command,tool
|
||||
action launch --hold --type=os-window kitty +shebang $FILE_PATH $SHELL
|
||||
106
kitty/pass_keys.py
Normal file
106
kitty/pass_keys.py
Normal file
@@ -0,0 +1,106 @@
|
||||
import re
|
||||
|
||||
from kittens.tui.handler import result_handler
|
||||
from kitty.key_encoding import KeyEvent, parse_shortcut
|
||||
|
||||
|
||||
def is_window_vim(window, vim_id):
|
||||
from kittens.tui.loop import debug
|
||||
debug(vim_id)
|
||||
fp = window.child.foreground_processes
|
||||
return any(re.search(vim_id, p['cmdline'][0] if len(p['cmdline']) else '', re.I) for p in fp)
|
||||
|
||||
|
||||
def encode_key_mapping(window, key_mapping):
|
||||
mods, key = parse_shortcut(key_mapping)
|
||||
event = KeyEvent(
|
||||
mods=mods,
|
||||
key=key,
|
||||
shift=bool(mods & 1),
|
||||
alt=bool(mods & 2),
|
||||
ctrl=bool(mods & 4),
|
||||
super=bool(mods & 8),
|
||||
hyper=bool(mods & 16),
|
||||
meta=bool(mods & 32),
|
||||
).as_window_system_event()
|
||||
|
||||
return window.encoded_key(event)
|
||||
|
||||
def relative_resize_window(direction, amount, target_window_id, boss):
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
if window is None:
|
||||
return
|
||||
|
||||
neighbors = boss.active_tab.current_layout.neighbors_for_window(window, boss.active_tab.windows)
|
||||
current_window_id = boss.active_tab.active_window
|
||||
|
||||
left_neighbors = neighbors.get('left')
|
||||
right_neighbors = neighbors.get('right')
|
||||
top_neighbors = neighbors.get('top')
|
||||
bottom_neighbors = neighbors.get('bottom')
|
||||
|
||||
# has a neighbor on both sides
|
||||
if direction == 'left' and (left_neighbors and right_neighbors):
|
||||
boss.active_tab.resize_window('narrower', amount)
|
||||
# only has left neighbor
|
||||
elif direction == 'left' and left_neighbors:
|
||||
boss.active_tab.resize_window('wider', amount)
|
||||
# only has right neighbor
|
||||
elif direction == 'left' and right_neighbors:
|
||||
boss.active_tab.resize_window('narrower', amount)
|
||||
|
||||
# has a neighbor on both sides
|
||||
elif direction == 'right' and (left_neighbors and right_neighbors):
|
||||
boss.active_tab.resize_window('wider', amount)
|
||||
# only has left neighbor
|
||||
elif direction == 'right' and left_neighbors:
|
||||
boss.active_tab.resize_window('narrower', amount)
|
||||
# only has right neighbor
|
||||
elif direction == 'right' and right_neighbors:
|
||||
boss.active_tab.resize_window('wider', amount)
|
||||
|
||||
# has a neighbor above and below
|
||||
elif direction == 'up' and (top_neighbors and bottom_neighbors):
|
||||
boss.active_tab.resize_window('shorter', amount)
|
||||
# only has top neighbor
|
||||
elif direction == 'up' and top_neighbors:
|
||||
boss.active_tab.resize_window('taller', amount)
|
||||
# only has bottom neighbor
|
||||
elif direction == 'up' and bottom_neighbors:
|
||||
boss.active_tab.resize_window('shorter', amount)
|
||||
|
||||
# has a neighbor above and below
|
||||
elif direction == 'down' and (top_neighbors and bottom_neighbors):
|
||||
boss.active_tab.resize_window('taller', amount)
|
||||
# only has top neighbor
|
||||
elif direction == 'down' and top_neighbors:
|
||||
boss.active_tab.resize_window('shorter', amount)
|
||||
# only has bottom neighbor
|
||||
elif direction == 'down' and bottom_neighbors:
|
||||
boss.active_tab.resize_window('taller', amount)
|
||||
|
||||
|
||||
def main():
|
||||
pass
|
||||
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(args, result, target_window_id, boss):
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
action = args[1]
|
||||
direction = args[2]
|
||||
key_mapping = args[3] if action == 'neighboring_window' else args[4]
|
||||
amount = int(args[3]) if action == 'relative_resize' else None
|
||||
vim_id_idx = 4 if action == 'neighboring_window' else 5
|
||||
vim_id = args[vim_id_idx] if len(args) > vim_id_idx else "n?vim"
|
||||
|
||||
if window is None:
|
||||
return
|
||||
if is_window_vim(window, vim_id):
|
||||
for keymap in key_mapping.split(">"):
|
||||
encoded = encode_key_mapping(window, keymap)
|
||||
window.write_to_child(encoded)
|
||||
elif action == 'neighboring_window':
|
||||
boss.active_tab.neighboring_window(direction)
|
||||
elif action == 'relative_resize':
|
||||
relative_resize_window(direction, amount, target_window_id, boss)
|
||||
94
kitty/relative_resize.py
Normal file
94
kitty/relative_resize.py
Normal file
@@ -0,0 +1,94 @@
|
||||
# Based on MIT licensed code at https://github.com/chancez/dotfiles/blob/badc69d3895a6a942285amount26b8c372a55d77533eamount/kitty/.config/kitty/relative_resize.py
|
||||
from kittens.tui.handler import result_handler
|
||||
from kitty.key_encoding import KeyEvent, parse_shortcut
|
||||
|
||||
|
||||
def encode_key_mapping(window, key_mapping):
|
||||
mods, key = parse_shortcut(key_mapping)
|
||||
event = KeyEvent(
|
||||
mods=mods,
|
||||
key=key,
|
||||
shift=bool(mods & 1),
|
||||
alt=bool(mods & 2),
|
||||
ctrl=bool(mods & 4),
|
||||
super=bool(mods & 8),
|
||||
hyper=bool(mods & 16),
|
||||
meta=bool(mods & 32),
|
||||
).as_window_system_event()
|
||||
|
||||
return window.encoded_key(event)
|
||||
|
||||
|
||||
def main(args):
|
||||
pass
|
||||
|
||||
|
||||
def relative_resize_window(direction, amount, target_window_id, boss):
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
if window is None:
|
||||
return
|
||||
|
||||
neighbors = boss.active_tab.current_layout.neighbors_for_window(
|
||||
window, boss.active_tab.windows
|
||||
)
|
||||
current_window_id = boss.active_tab.active_window
|
||||
|
||||
left_neighbors = neighbors.get('left')
|
||||
right_neighbors = neighbors.get('right')
|
||||
top_neighbors = neighbors.get('top')
|
||||
bottom_neighbors = neighbors.get('bottom')
|
||||
|
||||
# has a neighbor on both sides
|
||||
if direction == 'left' and (left_neighbors and right_neighbors):
|
||||
boss.active_tab.resize_window('narrower', amount)
|
||||
# only has left neighbor
|
||||
elif direction == 'left' and left_neighbors:
|
||||
boss.active_tab.resize_window('wider', amount)
|
||||
# only has right neighbor
|
||||
elif direction == 'left' and right_neighbors:
|
||||
boss.active_tab.resize_window('narrower', amount)
|
||||
|
||||
# has a neighbor on both sides
|
||||
elif direction == 'right' and (left_neighbors and right_neighbors):
|
||||
boss.active_tab.resize_window('wider', amount)
|
||||
# only has left neighbor
|
||||
elif direction == 'right' and left_neighbors:
|
||||
boss.active_tab.resize_window('narrower', amount)
|
||||
# only has right neighbor
|
||||
elif direction == 'right' and right_neighbors:
|
||||
boss.active_tab.resize_window('wider', amount)
|
||||
|
||||
# has a neighbor above and below
|
||||
elif direction == 'up' and (top_neighbors and bottom_neighbors):
|
||||
boss.active_tab.resize_window('shorter', amount)
|
||||
# only has top neighbor
|
||||
elif direction == 'up' and top_neighbors:
|
||||
boss.active_tab.resize_window('taller', amount)
|
||||
# only has bottom neighbor
|
||||
elif direction == 'up' and bottom_neighbors:
|
||||
boss.active_tab.resize_window('shorter', amount)
|
||||
|
||||
# has a neighbor above and below
|
||||
elif direction == 'down' and (top_neighbors and bottom_neighbors):
|
||||
boss.active_tab.resize_window('taller', amount)
|
||||
# only has top neighbor
|
||||
elif direction == 'down' and top_neighbors:
|
||||
boss.active_tab.resize_window('shorter', amount)
|
||||
# only has bottom neighbor
|
||||
elif direction == 'down' and bottom_neighbors:
|
||||
boss.active_tab.resize_window('taller', amount)
|
||||
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(args, result, target_window_id, boss):
|
||||
direction = args[1]
|
||||
amount = int(args[2])
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
|
||||
cmd = window.child.foreground_cmdline[0]
|
||||
if cmd == 'tmux':
|
||||
keymap = args[3]
|
||||
encoded = encode_key_mapping(window, keymap)
|
||||
window.write_to_child(encoded)
|
||||
else:
|
||||
relative_resize_window(direction, amount, target_window_id, boss)
|
||||
18
kitty/scroll_mark.py
Normal file
18
kitty/scroll_mark.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from kittens.tui.handler import result_handler
|
||||
from kitty.boss import Boss
|
||||
|
||||
|
||||
def main(args: list[str]) -> None:
|
||||
pass
|
||||
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(
|
||||
args: list[str], answer: str, target_window_id: int, boss: Boss
|
||||
) -> None:
|
||||
w = boss.window_id_map.get(target_window_id)
|
||||
if w is not None:
|
||||
if len(args) > 1 and args[1] != "prev":
|
||||
w.scroll_to_mark(prev=False)
|
||||
else:
|
||||
w.scroll_to_mark()
|
||||
49
kitty/split_window.py
Normal file
49
kitty/split_window.py
Normal file
@@ -0,0 +1,49 @@
|
||||
from kittens.tui.handler import result_handler
|
||||
from kitty.key_encoding import KeyEvent, parse_shortcut
|
||||
|
||||
|
||||
def main(args):
|
||||
pass
|
||||
|
||||
|
||||
def encode_key_mapping(window, key_mapping):
|
||||
mods, key = parse_shortcut(key_mapping)
|
||||
event = KeyEvent(
|
||||
mods=mods,
|
||||
key=key,
|
||||
shift=bool(mods & 1),
|
||||
alt=bool(mods & 2),
|
||||
ctrl=bool(mods & 4),
|
||||
super=bool(mods & 8),
|
||||
hyper=bool(mods & 16),
|
||||
meta=bool(mods & 32),
|
||||
).as_window_system_event()
|
||||
|
||||
return window.encoded_key(event)
|
||||
|
||||
|
||||
def split_window(boss, direction):
|
||||
if direction == 'up' or direction == 'down':
|
||||
boss.launch('--cwd=current', '--location=hsplit')
|
||||
else:
|
||||
boss.launch('--cwd=current', '--location=vsplit')
|
||||
|
||||
if direction == 'up' or direction == 'left':
|
||||
boss.active_tab.move_window(direction)
|
||||
|
||||
|
||||
@result_handler(no_ui=True)
|
||||
def handle_result(args, result, target_window_id, boss):
|
||||
window = boss.window_id_map.get(target_window_id)
|
||||
|
||||
if window is None:
|
||||
return
|
||||
|
||||
direction = args[1]
|
||||
cmd = window.child.foreground_cmdline[0]
|
||||
if cmd == 'tmux':
|
||||
keymap = args[2]
|
||||
encoded = encode_key_mapping(window, keymap)
|
||||
window.write_to_child(encoded)
|
||||
else:
|
||||
split_window(boss, direction)
|
||||
80
kitty/themes/catppuccin-macchiato.conf
Normal file
80
kitty/themes/catppuccin-macchiato.conf
Normal file
@@ -0,0 +1,80 @@
|
||||
# vim:ft=kitty
|
||||
|
||||
## name: Catppuccin-Macchiato
|
||||
## author: Pocco81 (https://github.com/Pocco81)
|
||||
## license: MIT
|
||||
## upstream: https://github.com/catppuccin/kitty/blob/main/macchiato.conf
|
||||
## blurb: Soothing pastel theme for the high-spirited!
|
||||
|
||||
|
||||
|
||||
# The basic colors
|
||||
foreground #CAD3F5
|
||||
background #24273A
|
||||
selection_foreground #24273A
|
||||
selection_background #F4DBD6
|
||||
|
||||
# Cursor colors
|
||||
cursor #F4DBD6
|
||||
cursor_text_color #24273A
|
||||
|
||||
# URL underline color when hovering with mouse
|
||||
url_color #F4DBD6
|
||||
|
||||
# Kitty window border colors
|
||||
active_border_color #B7BDF8
|
||||
inactive_border_color #6E738D
|
||||
bell_border_color #EED49F
|
||||
|
||||
# OS Window titlebar colors
|
||||
wayland_titlebar_color system
|
||||
macos_titlebar_color system
|
||||
|
||||
# Tab bar colors
|
||||
active_tab_foreground #181926
|
||||
active_tab_background #B7BDF8
|
||||
inactive_tab_foreground #CAD3F5
|
||||
inactive_tab_background #1E2030
|
||||
tab_bar_background #181926
|
||||
|
||||
# Colors for marks (marked text in the terminal)
|
||||
mark1_foreground #24273A
|
||||
mark1_background #B7BDF8
|
||||
mark2_foreground #24273A
|
||||
mark2_background #C6A0F6
|
||||
mark3_foreground #24273A
|
||||
mark3_background #7DC4E4
|
||||
|
||||
# The 16 terminal colors
|
||||
|
||||
# black
|
||||
color0 #494D64
|
||||
color8 #5B6078
|
||||
|
||||
# red
|
||||
color1 #ED8796
|
||||
color9 #ED8796
|
||||
|
||||
# green
|
||||
color2 #A6DA95
|
||||
color10 #A6DA95
|
||||
|
||||
# yellow
|
||||
color3 #EED49F
|
||||
color11 #EED49F
|
||||
|
||||
# blue
|
||||
color4 #8AADF4
|
||||
color12 #8AADF4
|
||||
|
||||
# magenta
|
||||
color5 #F5BDE6
|
||||
color13 #F5BDE6
|
||||
|
||||
# cyan
|
||||
color6 #8BD5CA
|
||||
color14 #8BD5CA
|
||||
|
||||
# white
|
||||
color7 #B8C0E0
|
||||
color15 #A5ADCB
|
||||
Reference in New Issue
Block a user