Here's the official documentation on configuring kitty
's modal mappings.
I made this to explore its uses but also because sometimes my fingers trigger the wrong reflex macro and I accidentally change my layout or alter the window size. This guards against that by literally guarding that behavior behind a key combo that puts me into the express context for altering my window/tab layout and arrangement.
To not clutter up your main config, I recommend saving this to its own file and using the include
directive to bring it in.
EDIT: learned that you can map the combo that enters the mode to get out of the mode
kitty-mode-window-tab-arrangement (WTA):
map --new-mode WTA kitty_mod+space>kitty_mod+space
map --mode WTA kitty_mod+space>kitty_mod+space pop_keyboard_mode
map --mode WTA esc pop_keyboard_mode
map --mode WTA ctrl+c pop_keyboard_mode
# Windows
#navigation
map --mode WTA h neighboring_window left
map --mode WTA a neighboring_window left
map --mode WTA left neighboring_window left
map --mode WTA j neighboring_window down
map --mode WTA s neighboring_window down
map --mode WTA down neighboring_window down
map --mode WTA k neighboring_window up
map --mode WTA w neighboring_window up
map --mode WTA up neighboring_window up
map --mode WTA l neighboring_window right
map --mode WTA d neighboring_window right
map --mode WTA right neighboring_window right
map --mode WTA f focus_visible_window
#resize
map --mode WTA alt+h resize_window narrower
map --mode WTA alt+a resize_window narrower
map --mode WTA alt+left resize_window narrower
map --mode WTA alt+l resize_window wider
map --mode WTA alt+d resize_window wider
map --mode WTA alt+right resize_window wider
map --mode WTA alt+k resize_window taller
map --mode WTA alt+w resize_window taller
map --mode WTA alt+up resize_window taller
map --mode WTA alt+j resize_window shorter
map --mode WTA alt+s resize_window shorter
map --mode WTA alt+down resize_window shorter
map --mode WTA ctrl+home resize_window reset
map --mode WTA ctrl+r resize_window reset
#arrange
map --mode WTA shift+h move_window left
map --mode WTA shift+a move_window left
map --mode WTA shift+left move_window left
map --mode WTA shift+l move_window right
map --mode WTA shift+d move_window right
map --mode WTA shift+right move_window right
map --mode WTA shift+j move_window down
map --mode WTA shift+s move_window down
map --mode WTA shift+down move_window down
map --mode WTA shift+k move_window up
map --mode WTA shift+w move_window up
map --mode WTA shift+up move_window up
map --mode WTA shift+m swap_with_window
# have to pop_keyboard_mode here to enable answering question
map --mode WTA shift+t combine : detach_window ask : pop_keyboard_mode
map --mode WTA shift+n combine : detach_tab ask : pop_keyboard_mode
# Tabs
map --mode WTA shift+alt+] move_tab_forward
map --mode WTA shift+alt+right move_tab_forward
map --mode WTA shift+alt+l move_tab_forward
map --mode WTA shift+alt+d move_tab_forward
map --mode WTA shift+alt+[ move_tab_backward
map --mode WTA shift+alt+left move_tab_backward
map --mode WTA shift+alt+h move_tab_backward
map --mode WTA shift+alt+a move_tab_backward
# Close others
map --mode WTA ctrl+x>w close_other_windows_in_tab
map --mode WTA ctrl+x>t close_other_tabs_in_os_window
map --mode WTA ctrl+x>o close_other_os_windows
# Layout actions
enabled_layouts tall:mirrored=true,fat,splits:split_axis=horizontal,splits:split_axis=vertical,grid,horizontal,vertical,stack,tall,fat:mirrored=true
map --mode WTA ctrl+alt+7 goto_layout tall
map --mode WTA kitty_mod+alt+7 toggle_layout tall:mirrored=true
map --mode WTA ctrl+alt+g goto_layout grid
map --mode WTA ctrl+alt+w goto_layout fat
map --mode WTA kitty_mod+alt+w toggle_layout fat:mirrored=true
map --mode WTA ctrl+alt+v goto_layout vertical
map --mode WTA ctrl+alt+h goto_layout horizontal
map --mode WTA ctrl+alt+z toggle_layout stack
map --mode WTA ctrl+alt+y toggle_layout splits:split_axis=horizontal
map --mode WTA kitty_mod+alt+y toggle_layout splits:split_axis=vertical
map --mode WTA ctrl+alt+, last_used_layout
# control number of main windows
action_alias increase_main layout_action increase_num_full_size_windows
map --mode WTA ctrl+] increase_main
map --mode WTA ctrl+up increase_main
map --mode WTA ctrl+right increase_main
map --mode WTA ctrl+l increase_main
map --mode WTA ctrl+w increase_main
map --mode WTA ctrl+d increase_main
action_alias decrease_main layout_action decrease_num_full_size_windows
map --mode WTA ctrl+[ decrease_main
map --mode WTA ctrl+down decrease_main
map --mode WTA ctrl+left decrease_main
map --mode WTA ctrl+h decrease_main
map --mode WTA ctrl+s decrease_main
map --mode WTA ctrl+a decrease_main
# increase main bias
action_alias increase_bias layout_action bias 50 66 75 90
map --mode WTA kitty_mod+] increase_bias
map --mode WTA kitty_mod+up increase_bias
map --mode WTA kitty_mod+right increase_bias
map --mode WTA kitty_mod+l increase_bias
map --mode WTA kitty_mod+w increase_bias
map --mode WTA kitty_mod+d increase_bias
# decrease main bias
action_alias decrease_bias layout_action bias 50 33 25 10
map --mode WTA kitty_mod+[ decrease_bias
map --mode WTA kitty_mod+down decrease_bias
map --mode WTA kitty_mod+left decrease_bias
map --mode WTA kitty_mod+h decrease_bias
map --mode WTA kitty_mod+s decrease_bias
map --mode WTA kitty_mod+a decrease_bias
here's an actual article about it instead of just a random picture and text