# vim:fileencoding=utf-8:foldmethod=marker

update_check_interval 6


# Unmapped

map kitty_mod+t no_op
map kitty_mod+r no_op


# Aliases

action_alias overlay launch --type overlay-main

action_alias copy_to copy_to_buffer
action_alias paste_from paste_from_buffer

action_alias path_hints kitten hints --type path --ascending --hints-foreground-color black --hints-background-color white --hints-text-color blue
action_alias link_hints kitten hints --type hyperlink --ascending --hints-foreground-color black --hints-background-color white --hints-text-color blue

# Overlays

map alt+f1 overlay --title "scrollback overlay" --stdin-source=@screen_scrollback most +1000000
map alt+f2 overlay --title "pandora overlay" screen -d -RR pianobar pianobar

map alt+f4 overlay --title "scratch overlay" screen -d -RR scratch nano /tmp/scratch
map alt+f5 show_kitty_doc ~/.config/kitty/docs/conf
map alt+f6 overlay --title "cwd overlay" --cwd current
map alt+f7 overlay --title "TODO overlay" screen -d -RR todo nano $HOME/Documents/.notes/to_do
map alt+f8 overlay --title "nudoku overlay" screen -d -RR nudoku /usr/games/nudoku -d hard
map alt+shift+f8 overlay --title "mazter overlay" screen -d -RR mazter $HOME/.cargo/bin/mazter
map kitty_mod+f8 overlay --title "debug" cmatrix -ab -C blue -u 2
map alt+f9 overlay --title "w3m overlay" screen -d -RR w3m w3m -B
map alt+f10 overlay --title "htop overlay" screen -d -RR htop htop
map alt+shift+f10 overlay --title "btop overlay" screen -d -RR btop btop
map alt+f11 overlay --title "ssh:gamerboxloc overlay" kitty +kitten ssh christopher@gamerboxloc
map alt+shift+f11 overlay --title "ssh:gamerboxint overlay" kitty +kitten ssh -p 42317 christopher@gamerboxint
map alt+f12 overlay --title "customizations overlay" most -v $HOME/.config/kitty/personalizations-help

map kitty_mod+f2 overlay --title "kitty.conf overlay" screen -d -RR kitty.conf nano $HOME/.config/kitty/kitty.conf $HOME/.config/kitty/personalizations-help


# Program quick launch

#video
map ctrl+p>f1 send_text normal,application celluloid *.*\r

#audio
map ctrl+p>f2 send_text normal,application mpg123 *\r

#file mangers
map ctrl+p>p  send_text normal,application clifm\r
map ctrl+p>r send_text normal,application ranger\r

#ssh
map ctrl+p>g>l send_text normal,application kitty +kitten ssh christopher@gamerboxloc\r
map ctrl+p>g>i send_text normal,application kitty +kitten ssh -p $GAMERBOX_INT_PORT christopher@gamerboxint\r

# Under the hood

editor nano
#editor micro

detect_urls yes
open_url_with ranger

allow_remote_control yes

scrollback_lines 2500
strip_trailing_spaces smart

enable_audio_bell no
window_alert_on_bell no

mouse_hide_wait 3.0
cursor_stop_blinking_after 3
shell_integration no-cursor


# Look and feel

#theme
include Night Lion V1.conf

remember_window_size  no
hide_window_decorations yes

initial_window_width  1280
initial_window_height 720

dynamic_background_opacity yes
background_opacity 1.0

cursor #88ffbb
cursor_text_color #115533
cursor_shape block
disable_ligatures cursor

font_size 11.0

#borders
#draw_minimal_borders yes
window_margin_width 1.0
single_window_margin_width 1.0
window_border_width 1.0
window_padding_width 2.0

#active_border_color #CCFFEE
active_border_color #a8c8ff
inactive_border_color #505050
inactive_text_alpha 0.5

#tab bar
tab_bar_min_tabs 1
#tab_bar_background #191919
tab_bar_align center
tab_title_max_length 25

#fade slant separator powerline hidden
tab_bar_style fade

tab_fade 0.5 0.75

#angled round slanted
tab_powerline_style angled

tab_separator " | "

tab_activity_symbol ⁂

tab_title_template {title} [{index}]{fmt.bold}{activity_symbol}{fmt.nobold}
active_tab_title_template " {title} "

active_tab_font_style   bold

inactive_tab_foreground #fff
inactive_tab_background #337598
inactive_tab_font_style italic

#background
#background_image $HOME/Pictures/backgrounds/black-and-white-mountain-scape.png
#background_image_layout scaled
#background_tint 0.55

#logo
window_logo_path $HOME/Pictures/backgrounds/kittymint-black-white.png
window_logo_position center
window_logo_alpha 0.005

#font
font_family      JetBrainsMonoNL Nerd Font
italic_font	 JetBrains Mono Bold Italic Nerd Font Complete
bold_font        JetBrains Mono ExtraBold Nerd Font Complete Mono
bold_italic_font JetBrains Mono ExtraBold Italic Nerd Font Complete Mono


# Layouts

enabled_layouts tall,fat,splits:split_axis=horizontal,splits:split_axis=vertical,grid,horizontal,vertical,stack,tall:mirrored=true,fat:mirrored=true

map ctrl+alt+7 goto_layout tall
map kitty_mod+alt+7 toggle_layout tall:mirrored=true
map ctrl+alt+g goto_layout grid
map ctrl+alt+w goto_layout fat
map kitty_mod+alt+w toggle_layout fat:mirrored=true
map ctrl+alt+v goto_layout vertical
map ctrl+alt+h goto_layout horizontal
map ctrl+alt+z toggle_layout stack
map ctrl+alt+y toggle_layout splits:split_axis=horizontal
map kitty_mod+alt+y toggle_layout splits:split_axis=vertical
map ctrl+alt+, last_used_layout

map ctrl+] layout_action increase_num_full_size_windows
map ctrl+[ layout_action decrease_num_full_size_windows


# Kitten customizations

#hints
map kitty_mod+p>f path_hints --program -
map kitty_mod+p>x link_hints --program xed
map kitty_mod+p>r link_hints --program -
map kitty_mod+p>y link_hints --program default


# Windows

#resize
map kitty_mod+left resize_window narrower
map kitty_mod+right resize_window wider
map kitty_mod+up resize_window taller
map kitty_mod+down resize_window shorter
map kitty_mod+home resize_window reset

#scroll
map shift+alt+k scroll_line_up
map shift+alt+j scroll_line_down
map shift+alt+page_up scroll_page_up
map shift+alt+page_down scroll_page_down
map shift+alt+\ scroll_home
map shift+alt+/ scroll_end

#new
map ctrl+alt+enter launch --cwd current
map kitty_mod+alt+f11 launch kitty +kitten ssh christopher@gamerboxloc

#arrange
map kitty_mod+h move_window left
map kitty_mod+j move_window down
map kitty_mod+k move_window up
map kitty_mod+l move_window right

#navigation
map alt+h neighboring_window left
map alt+j neighboring_window down
map alt+k neighboring_window up
map alt+l neighboring_window right
map alt+f focus_visible_window

#splits
map kitty_mod+o launch --location=hsplit
#map kitty_mod+e launch --location=vsplit
map kitty_mod+alt+= layout_action rotate


# Tabs

#navigation
map alt+shift+1 goto_tab 1
map alt+shift+2 goto_tab 2
map alt+shift+3 goto_tab 3
map alt+shift+4 goto_tab 4
map alt+shift+5 goto_tab 5
map alt+shift+6 goto_tab 6
map alt+shift+7 goto_tab 7
map alt+shift+8 goto_tab 8
map alt+shift+9 goto_tab 9
map alt+shift+0 goto_tab 10

map shift+alt+[ previous_tab
map shift+alt+] next_tab

map shift+alt+s select_tab

#new
map alt+shift+enter launch --type tab
map alt+shift+. launch --type tab --cwd current


# Advanced rearrangement

map kitty_mod+m>s swap_with_window
map kitty_mod+m>t detach_window ask
map kitty_mod+m>a detach_tab ask

# Clearing terminal

    # TODO

# Close others

map kitty_mod+x>w close_other_windows_in_tab
map kitty_mod+x>t close_other_tabs_in_os_window


# Copy

map ctrl+alt+c>1 copy_to 1first
map ctrl+alt+c>2 copy_to 2second
map ctrl+alt+c>3 copy_to 3third
map ctrl+alt+c>4 copy_to 4fourth
map ctrl+alt+c>5 copy_to 5fifth
map ctrl+alt+c>6 copy_to 6sixth
map ctrl+alt+c>7 copy_to 7seventh
map ctrl+alt+c>8 copy_to 8eighth
map ctrl+alt+c>9 copy_to 9ninth
map ctrl+alt+c>0 copy_to 0tenth

copy_on_select selectionCopy


# Paste

map shift+alt+v>1 paste_from 1first
map shift+alt+v>2 paste_from 2second
map shift+alt+v>3 paste_from 3third
map shift+alt+v>4 paste_from 4fourth
map shift+alt+v>5 paste_from 5fifth
map shift+alt+v>6 paste_from 6sixth
map shift+alt+v>7 paste_from 7seventh
map shift+alt+v>8 paste_from 8eighth
map shift+alt+v>9 paste_from 9ninth
map shift+alt+v>0 paste_from 0tenth

map shift+alt+v>s paste_from selectionCopy


# Opacity

map kitty_mod+alt+o>1 set_background_opacity 0.1
map kitty_mod+alt+o>2 set_background_opacity 0.2
map kitty_mod+alt+o>3 set_background_opacity 0.3
map kitty_mod+alt+o>4 set_background_opacity 0.4
map kitty_mod+alt+o>5 set_background_opacity 0.5
map kitty_mod+alt+o>6 set_background_opacity 0.6
map kitty_mod+alt+o>7 set_background_opacity 0.7
map kitty_mod+alt+o>8 set_background_opacity 0.8
map kitty_mod+alt+o>9 set_background_opacity 0.9
map kitty_mod+alt+o>0 set_background_opacity 1.0

map kitty_mod+[ set_background_opacity -0.05
map kitty_mod+] set_background_opacity +0.05

map ctrl+alt+- change_font_size current -1.0
map ctrl+alt+= change_font_size current +1.0

map kitty_mod+alt+o>d set_background_opacity default


# Misc

map kitty_mod+alt+home kitty_shell window