kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.11k stars 972 forks source link

Key sequence is not sent to children if a prefix is mapped by kitty #5840

Closed ppwwyyxx closed 1 year ago

ppwwyyxx commented 1 year ago

Describe the bug

Tmux by default accept Ctrl+b > c to create new tmux tab. However, if Ctrl+b > l is mapped in kitty, then Ctrl+b > c doesn't work for tmux any more.

To Reproduce Steps to reproduce the behavior:

  1. Create a kitty config with a single line map ctrl+b>l kitten hints --type hyperlink
  2. Start kitty using this config
  3. Start a fresh tmux inside kitty using default config: tmux -f /dev/null -L test
  4. Type Ctrl+b then c, no tab is created. However, I expect kitty to recognize the key sequence and send Ctrl+b>c to tmux.

Environment details


kitty 0.26.5 created by Kovid Goyal
Linux KeepRunning 5.15.85-1-lts #1 SMP Thu, 22 Dec 2022 06:22:00 +0000 x86_64
Arch Linux 5.15.85-1-lts (/dev/tty)

DISTRIB_ID="Arch"
DISTRIB_RELEASE="rolling"
DISTRIB_DESCRIPTION="Arch Linux"
Running under: X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/zsh
Loaded config files:
  /home/USERNAME/.config/kitty/kitty.conf

Config options different from defaults:
active_tab_font_style             (True, False)
active_tab_title_template         {fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}😸{sup.index}{title}
background_opacity                0.9
cursor_beam_thickness             4.5
cursor_shape                      2
cursor_text_color                 None
enable_audio_bell                 False
enabled_layouts                   ['splits']
focus_follows_mouse               True
font_size                         19.0
hide_window_decorations           1
linux_display_server              x11
scrollback_fill_enlarged_window   True
scrollback_lines                  10000
scrollback_pager_history_size     10485760
select_by_word_characters         @-._~?&%+#
select_by_word_characters_forward =/
strip_trailing_spaces             smart
tab_bar_style                     powerline
tab_title_template                {fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{sup.index}{title}
url_excluded_characters           >
Added shortcuts:
    alt+h β†’  kitten smart_tab.py previous_tab alt+h
    alt+l β†’  kitten smart_tab.py next_tab alt+l
    ctrl+q > " β†’  kitten smart_tab.py hsplit ctrl+q>\"
    ctrl+q > % β†’  kitten smart_tab.py vsplit ctrl+q>%
    ctrl+t β†’  kitten smart_tab.py new_tab ctrl+t
    kitty_mod+h > h β†’  show_scrollback
    kitty_mod+h > l β†’  show_last_command_output
    kitty_mod+p > o β†’  kitten hints --type path
    kitty_mod+p > u β†’  kitten hints --type regex --regex '(?:http://|ftp://|https://|file://|go/)[^\x00-\t\x0b-\x0c\x0e-\x20\x7f-\xa0\xad\u0600-\u0605\u061c\u06dd\u070f\u0890-\u0891\u08e2\u1680\u180e\u2000-\u200f\u2028-\u202f\u205f-\u2064\u2066-\u206f\u3000\ud800-\uf8ff\ufeff\ufff9-\ufffb\U000110bd\U000110cd\U00013430-\U0001343f\U0001bca0-\U0001bca3\U0001d173-\U0001d17a\U000e0001\U000e0020-\U000e007f\U000f0000-\U000ffffd\U00100000-\U0010fffd]{3,}|(?:b|cl)/[0-9]+|/google3/[a-zA-Z0-9_]{3,}/[a-zA-Z0-9\.\/\+-]{3,}' --program hyperlink-open.py --hints-text-color green
    shift+page_down β†’  scroll_page_down
    shift+page_up β†’  scroll_page_up
Removed shortcuts:
    ctrl+shift+tab β†’  previous_tab
    ctrl+tab β†’  next_tab
    kitty_mod+, β†’  move_tab_backward
    kitty_mod+. β†’  move_tab_forward
    kitty_mod+0 β†’  tenth_window
    kitty_mod+1 β†’  first_window
    kitty_mod+2 β†’  second_window
    kitty_mod+3 β†’  third_window
    kitty_mod+4 β†’  fourth_window
    kitty_mod+5 β†’  fifth_window
    kitty_mod+6 β†’  sixth_window
    kitty_mod+7 β†’  seventh_window
    kitty_mod+8 β†’  eighth_window
    kitty_mod+9 β†’  ninth_window
    kitty_mod+[ β†’  previous_window
    kitty_mod+] β†’  next_window
    kitty_mod+` β†’  move_window_to_top
    kitty_mod+a > 1 β†’  set_background_opacity 1
    kitty_mod+a > d β†’  set_background_opacity default
    kitty_mod+a > l β†’  set_background_opacity -0.1
    kitty_mod+a > m β†’  set_background_opacity +0.1
    kitty_mod+alt+t β†’  set_tab_title
    kitty_mod+b β†’  move_window_backward
    kitty_mod+delete β†’  clear_terminal reset active
    kitty_mod+e β†’  open_url_with_hints
    kitty_mod+end β†’  scroll_end
    kitty_mod+enter β†’  new_window
    kitty_mod+f β†’  move_window_forward
    kitty_mod+f1 β†’  show_kitty_doc overview
    kitty_mod+f10 β†’  toggle_maximized
    kitty_mod+f11 β†’  toggle_fullscreen
    kitty_mod+f2 β†’  edit_config_file
    kitty_mod+f7 β†’  focus_visible_window
    kitty_mod+f8 β†’  swap_with_window
    kitty_mod+g β†’  show_last_command_output
    kitty_mod+h β†’  show_scrollback
    kitty_mod+home β†’  scroll_home
    kitty_mod+j β†’  scroll_line_down
    kitty_mod+k β†’  scroll_line_up
    kitty_mod+l β†’  next_layout
    kitty_mod+left β†’  previous_tab
    kitty_mod+n β†’  new_os_window
    kitty_mod+o β†’  pass_selection_to_program
    kitty_mod+p > h β†’  kitten hints --type hash --program -
    kitty_mod+p > n β†’  kitten hints --type linenum
    kitty_mod+p > shift+f β†’  kitten hints --type path
    kitty_mod+p > w β†’  kitten hints --type word --program -
    kitty_mod+p > y β†’  kitten hints --type hyperlink
    kitty_mod+page_down β†’  scroll_page_down
    kitty_mod+page_up β†’  scroll_page_up
    kitty_mod+q β†’  close_tab
    kitty_mod+r β†’  start_resizing_window
    kitty_mod+right β†’  next_tab
    kitty_mod+s β†’  paste_from_selection
    kitty_mod+t β†’  new_tab
    kitty_mod+u β†’  kitten unicode_input
    kitty_mod+w β†’  close_window
    kitty_mod+x β†’  scroll_to_prompt 1
    kitty_mod+z β†’  scroll_to_prompt -1
    shift+insert β†’  paste_from_selection
Changed shortcuts:
    kitty_mod+down β†’  scroll_to_prompt 1
    kitty_mod+p > l β†’  kitten hints --type hyperlink
    kitty_mod+up β†’  scroll_to_prompt -1
Colors:
    active_tab_background             #0ab2ff   
    cursor                            #be5160   
    inactive_tab_background           #0a65ff   
    inactive_tab_foreground           #000000   

Important environment variables seen by the kitty process:
    PATH                                OMITTED
    LANG                                en_US.UTF-8
    SHELL                               /bin/zsh
    GLFW_IM_MODULE                      ibus
    DISPLAY                             :0.0
    USER                                USERNAME
    XCURSOR_SIZE                        24
    XDG_CONFIG_DIRS                     /home/USERNAME/.config/kdedefaults:/etc/xdg
    XDG_SESSION_PATH                    /org/freedesktop/DisplayManager/Session1
    XDG_SEAT                            seat0
    XDG_SESSION_DESKTOP                 KDE
    XDG_SESSION_TYPE                    x11
    XDG_CURRENT_DESKTOP                 KDE
    XDG_SEAT_PATH                       /org/freedesktop/DisplayManager/Seat0
    XDG_SESSION_CLASS                   user
    XDG_VTNR                            2
    XDG_SESSION_ID                      2
    XDG_RUNTIME_DIR                     /run/user/1000
    XDG_DATA_DIRS                       /home/USERNAME/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop

kovidgoyal commented 1 year ago

Yes, since the keypress is part of a kitty sequence, it is not available for terminal programs. I could technically send the events to the child program if the sequence doesnt match anything, but this is pretty complex, since one has to possibly send multiple press, release events. So you would need to store all these while the sequence is in progress and the encode them based on the current keyboard mode of the active window and send them. Not worth the effort at least for me.