lnk: added kitty
parent
1839e4f146
commit
3784b40400
|
|
@ -0,0 +1,45 @@
|
|||
# Flow colorscheme | Kitty
|
||||
# https://github.com/0xstepit/flow.nvim
|
||||
|
||||
# Basic colors
|
||||
background #1b2228
|
||||
foreground #b3c1cc
|
||||
selection_foreground #ff007b
|
||||
selection_background #0d0d0d
|
||||
|
||||
# Normal colors
|
||||
color0 #0d0d0d
|
||||
color1 #f0757f
|
||||
color2 #80f075
|
||||
color3 #f0e675
|
||||
color4 #75bdf0
|
||||
color5 #a875f0
|
||||
color6 #75f0e6
|
||||
color7 #f2f2f2
|
||||
|
||||
# Bright colors
|
||||
color8 #3d4f5c
|
||||
color9 #f0757f
|
||||
color10 #80f075
|
||||
color11 #f0e675
|
||||
color12 #75bdf0
|
||||
color13 #a875f0
|
||||
color14 #75f0e6
|
||||
color15 #f2f2f2
|
||||
|
||||
# Url color
|
||||
url_color #75bdf0
|
||||
|
||||
# Cursor
|
||||
cursor #ff007b
|
||||
cursor_text_color #0d0d0d
|
||||
|
||||
# Tabs
|
||||
active_tab_background #75bdf0
|
||||
active_tab_foreground #0d0d0d
|
||||
inactive_tab_background #3d4f5c
|
||||
inactive_tab_foreground #75bdf0
|
||||
|
||||
# Borders
|
||||
active_border_color #757ff0
|
||||
inactive_border_color #3d4f5c
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -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])
|
||||
|
|
@ -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)
|
||||
|
|
@ -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)
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# Flow colorscheme | Kitty
|
||||
# https://github.com/0xstepit/flow.nvim
|
||||
|
||||
# Basic colors
|
||||
background #1b2228
|
||||
foreground #b3c1cc
|
||||
selection_foreground #ff007b
|
||||
selection_background #0d0d0d
|
||||
|
||||
# Normal colors
|
||||
color0 #0d0d0d
|
||||
color1 #f0757f
|
||||
color2 #80f075
|
||||
color3 #f0e675
|
||||
color4 #75bdf0
|
||||
color5 #a875f0
|
||||
color6 #75f0e6
|
||||
color7 #f2f2f2
|
||||
|
||||
# Bright colors
|
||||
color8 #3d4f5c
|
||||
color9 #f0757f
|
||||
color10 #80f075
|
||||
color11 #f0e675
|
||||
color12 #75bdf0
|
||||
color13 #a875f0
|
||||
color14 #75f0e6
|
||||
color15 #f2f2f2
|
||||
|
||||
# Url color
|
||||
url_color #75bdf0
|
||||
|
||||
# Cursor
|
||||
cursor #ff007b
|
||||
cursor_text_color #0d0d0d
|
||||
|
||||
# Tabs
|
||||
active_tab_background #75bdf0
|
||||
active_tab_foreground #0d0d0d
|
||||
inactive_tab_background #3d4f5c
|
||||
inactive_tab_foreground #75bdf0
|
||||
|
||||
# Borders
|
||||
active_border_color #757ff0
|
||||
inactive_border_color #3d4f5c
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package.path = package.path .. ";../?.lua;../flow/?.lua"
|
||||
|
||||
local util = require("util")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.generate(colors)
|
||||
return util.interpolate(M.template, colors)
|
||||
end
|
||||
|
||||
M.template = [=[
|
||||
# Flow colorscheme | Kitty
|
||||
# https://github.com/0xstepit/flow.nvim
|
||||
|
||||
# Basic colors
|
||||
background ${bg}
|
||||
foreground ${fg}
|
||||
selection_foreground ${fluo}
|
||||
selection_background ${black}
|
||||
|
||||
# Normal colors
|
||||
color0 ${black}
|
||||
color1 ${red}
|
||||
color2 ${green}
|
||||
color3 ${yellow}
|
||||
color4 ${light_blue}
|
||||
color5 ${purple}
|
||||
color6 ${cyan}
|
||||
color7 ${white}
|
||||
|
||||
# Bright colors
|
||||
color8 ${fg_statusline}
|
||||
color9 ${red}
|
||||
color10 ${green}
|
||||
color11 ${yellow}
|
||||
color12 ${light_blue}
|
||||
color13 ${purple}
|
||||
color14 ${cyan}
|
||||
color15 ${white}
|
||||
|
||||
# Url color
|
||||
url_color ${light_blue}
|
||||
|
||||
# Cursor
|
||||
cursor ${fluo}
|
||||
cursor_text_color ${black}
|
||||
|
||||
# Tabs
|
||||
active_tab_background ${light_blue}
|
||||
active_tab_foreground ${black}
|
||||
inactive_tab_background ${fg_statusline}
|
||||
inactive_tab_foreground ${light_blue}
|
||||
|
||||
# Borders
|
||||
active_border_color ${blue}
|
||||
inactive_border_color ${fg_statusline}
|
||||
]=]
|
||||
|
||||
return M
|
||||
Loading…
Reference in New Issue