# Kitty Terminal Config for PAI
# Optimized for Claude Code and PAI workflows

# Window Management
remember_window_size no
initial_window_width 75c
initial_window_height 65c
window_padding_width 16
confirm_os_window_close 0
enabled_layouts tall,fat,horizontal,vertical,grid,stack

# Tab Bar Styling
tab_bar_edge top
tab_bar_style powerline
tab_bar_min_tabs 1
tab_title_template "{index}: {title}"
active_tab_foreground   #c0caf5
active_tab_background   #1244B3
active_tab_font_style   bold
inactive_tab_foreground #787c99
inactive_tab_background #1a1b26
inactive_tab_font_style normal

# Shell Integration
shell_integration enabled
shell zsh

# Theme - Tokyo Night Storm with custom colors
background #24283b
foreground #c0caf5
selection_background #775095
selection_foreground #c0caf5

# Cursor
cursor #bb9af7
cursor_text_color #24283b
cursor_shape block
cursor_blink_interval 0

# Colors - Tokyo Night Storm palette
color0  #1a1b26
color1  #f7768e
color2  #9ece6a
color3  #e0af68
color4  #7aa2f7
color5  #bb9af7
color6  #7dcfff
color7  #a9b1d6

color8  #414868
color9  #f7768e
color10 #9ece6a
color11 #e0af68
color12 #7aa2f7
color13 #bb9af7
color14 #7dcfff
color15 #c0caf5

# Fonts
font_family Hack Nerd Font
bold_font Hack Nerd Font Bold
italic_font Hack Nerd Font Italic
bold_italic_font Hack Nerd Font Bold Italic
font_size 19.0
font_features +liga
disable_ligatures never
text_composition_strategy 1.0 20

# Keyboard Shortcuts
# Config reload
map shift+cmd+r load_config_file

# Tab management
map cmd+t new_tab
map cmd+w close_tab
map ctrl+t next_tab

# Launch new PAI session (new tab + run 'pai' command)
map cmd+shift+n launch --type=tab --cwd=current zsh -ic "pai"

# Window/Split management - Create new panes with Cmd+Shift
map cmd+shift+l launch --location=vsplit
map cmd+shift+h launch --location=vsplit --location=before
map cmd+shift+k launch --location=hsplit --location=before
map cmd+shift+j launch --location=hsplit

# Navigate between tabs with Ctrl+H/L
map ctrl+h previous_tab
map ctrl+l next_tab

# Move tabs left/right (reorder position)
map ctrl+shift+h move_tab_backward
map ctrl+shift+l move_tab_forward

# Navigate between panes (vim-style) - using Cmd
map cmd+h neighboring_window left
map cmd+j neighboring_window down
map cmd+k neighboring_window up
map cmd+l neighboring_window right

# Resize windows - using Ctrl+Cmd (native kitty resize)
map ctrl+cmd+h resize_window narrower
map ctrl+cmd+l resize_window wider
map ctrl+cmd+k resize_window taller
map ctrl+cmd+j resize_window shorter

# Scrollback
scrollback_lines 10000
scrollback_pager_history_size 10

# Mouse
hide_window_decorations titlebar-only
mouse_hide_wait 0

# Background
# Note: background_opacity must be 1.0 for background images to work properly
# Use background_tint to control image opacity instead
background_opacity 1.0
dynamic_background_opacity no
background_blur 0

# Background Image
# Update this path to your PAI directory if different from ~/.claude/
background_image ~/.claude/skills/CORE/USER/TERMINAL/ul-circuit-embossed-v5.png
# Use 'cscaled' to scale and center, preserving aspect ratio
background_image_layout cscaled
# Tint: Higher value = brighter image (1.0 = full brightness)
background_tint 0.96

# Selection/Clipboard
copy_on_select yes
strip_trailing_spaces smart
clipboard_control write-clipboard write-primary read-clipboard read-primary

# macOS Specific
macos_option_as_alt yes
macos_titlebar_color background
macos_traditional_fullscreen no
macos_show_window_title_in all
macos_custom_beam_cursor yes
macos_thicken_font 0.75

# Performance
repaint_delay 10
input_delay 3
sync_to_monitor yes

# URLs
url_style curly
open_url_with default
detect_urls yes
url_prefixes file ftp ftps gemini git gopher http https irc ircs kitty mailto news sftp ssh

# Special key mappings for newline
map shift+enter send_text all \n
# Ctrl+Enter for ZSH autosuggestion completion
map ctrl+enter send_text all \x1b[27;5;13~

# Window borders and margins
window_border_width 0pt
draw_minimal_borders yes
active_border_color #bb9af7
inactive_border_color #414868
bell_border_color #e0af68

# Bell
enable_audio_bell no
visual_bell_duration 0.0
window_alert_on_bell yes

# Advanced - Required for PAI tab state management
allow_remote_control yes
listen_on unix:/tmp/kitty
update_check_interval 0
startup_session none
allow_hyperlinks yes
