cyd01 / KiTTY

:computer: KiTTY, a free telnet/ssh client for Windows
https://www.9bis.com/kitty
Other
1.61k stars 137 forks source link

Pressing some shortcuts writes strange characters in the Kitty Terminal #466

Open p1r473 opened 1 year ago

p1r473 commented 1 year ago

Pressing some shortcuts writes strange characters in the Kitty Terminal.

For example: shift+f1 prints "P" shift+f2 prints "Q"

I am trying to use Shift+F1, Control+F2, etc, in Kitty to control Byobu, but they don't work.

Right now, I have: Terminal->Keyboard->Function set to Xterm R6 Connection->Data->Terminal-type string set to xterm (I tried putty-256color and kitty-256color and these broke F1-F2-F3-F4) kitty.ini:

[KiTTY]
; shortcuts: enable/disable keybord shortcuts
shortcuts=no

How can I turn this feature off? Is there any workaround (other than rebinding all the keys?) I'd like to ideally use the Function keys instead of screen's keybindings (https://www.gnu.org/software/screen/manual/html_node/Default-Key-Bindings.html)

Is there any way I can remap the keys in Kitty like https://stackoverflow.com/a/26470118/5859029?

F1                             * Used by X11 *
    Shift-F1                     Display this help
  F2                             Create a new window
    Shift-F2                     Create a horizontal split
    Ctrl-F2                      Create a vertical split
    Ctrl-Shift-F2                Create a new session
  F3/F4                          Move focus among windows
    Alt-Left/Right               Move focus among windows
    Alt-Up/Down                  Move focus among sessions
    Shift-Left/Right/Up/Down     Move focus among splits
    Shift-F3/F4                  Move focus among splits
    Ctrl-F3/F4                   Move a split
    Ctrl-Shift-F3/F4             Move a window
    Shift-Alt-Left/Right/Up/Down Resize a split
  F5                             Reload profile, refresh status
    Alt-F5                       Toggle UTF-8 support, refresh status
    Shift-F5                     Toggle through status lines
    Ctrl-F5                      Reconnect ssh/gpg/dbus sockets
    Ctrl-Shift-F5                Change status bar's color randomly
  F6                             Detach session and then logout
    Shift-F6                     Detach session and do not logout
    Alt-F6                       Detach all clients but yourself
    Ctrl-F6                      Kill split in focus
  F7                             Enter scrollback history
    Alt-PageUp/PageDown          Enter and move through scrollback
    Shift-F7                     Save history to $BYOBU_RUN_DIR/printscreen
  F8                             Rename the current window
    Ctrl-F8                      Rename the current session
    Shift-F8                     Toggle through split arrangements
    Alt-Shift-F8                 Restore a split-pane layout
    Ctrl-Shift-F8                Save the current split-pane layout
  F9                             Launch byobu-config window
    Ctrl-F9                      Enter command and run in all windows
    Shift-F9                     Enter command and run in all splits
    Alt-F9                       Toggle sending keyboard input to all splits
  F10                            * Used by X11 *
  F11                            * Used by X11 *
    Alt-F11                      Expand split to a full window
    Shift-F11                    Zoom into a split, zoom out of a split
    Ctrl-F11                     Join window into a vertical split
  F12                            Escape sequence
    Shift-F12                    Toggle on/off Byobu's keybindings
    Alt-F12                      Toggle on/off Byobu's mouse support
    Ctrl-Shift-F12               Mondrian squares

In /usr/share/byobu/keybindings/f-keys.screen

# F-keys seem to work well in both gnome-terminal and tty consoles
bindkey -k k1 $BYOBU_BACKEND -t config 0 byobu-config   # F1  | Configuration (along with F9)
                                                        #     | since F1 = Help in gnome-terminal
bindkey "^[O1;2P" $BYOBU_BACKEND -t help 0 $BYOBU_PAGER $BYOBU_PREFIX/share/doc/byobu/help.screen.txt   # shift-F1  | help
bindkey -k k2 $BYOBU_BACKEND                            # F2  | Create new window
bindkey "^[O1;5Q" eval 'split -v' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' 'screen' # ctrl-F2  | vertical split
bindkey "^[O1;2Q" eval 'split' 'focus down' 'next' 'focus up' 'layout save byobu' 'layout autosave' 'screen'    # shift-F2 | horizontal split
# No ctrl-shift-F2 (new session) in Screen
bindkey -k k3 eval 'prev' 'fit'                         # F3         | Previous Window
bindkey -k k4 eval 'next' 'fit'                         # F4         | Next Window
bindkey "^[[1;3D" eval 'prev' 'fit'                     # alt-left   | Previous Window
bindkey "^[[1;3C" eval 'next' 'fit'                     # alt-right  | Next Window
# No alt-up (previous session) in Screen
# No alt-down (next session) in Screen
bindkey "^[O1;2R" focus up                              # shift-F3 | focus up
bindkey "^[O1;2S" focus down                            # shift-F4 | focus down
bindkey "^[[1;2A" focus up                              # shift-up | focus up
bindkey "^[[1;2B" focus down                            # shift-up | focus down
bindkey "^[[1;2D" focus up                              # shift-left | focus up
bindkey "^[[1;2C" focus down                            # shift-right | focus down
# No ctrl-shift-F3 (move pane) in Screen
# No ctrl-shift-F4 (move pane) in Screen
bindkey "^[[1;4A" resize +1                             # shift-alt-up    | resize +1
bindkey "^[[1;4B" resize -1                             # shift-alt-down  | resize -1
bindkey "^[[1;4D" resize -1                             # shift-alt-left  | resize -1
bindkey "^[[1;4C" resize +1                             # shift-alt-right | resize +1
register r ":source $BYOBU_CONFIG_DIR/profile^M"        #     | Goes with F5 definition
bindkey -k k5 eval 'process x' 'process r'              # F5  | Reload profile
bindkey "^[[15;5~" eval 'process x' 'process r' 'stuff ". $BYOBU_PREFIX/bin/byobu-reconnect-sockets^M"' # ctrl-F5 | reconnect gpg/ssh/x sockets
bindkey "^[[15;6~" $BYOBU_BACKEND -t color 0 byobu-select-profile       # ctrl-shift-F5  | choose a background color
bindkey "^[[15;2~" only                                 # shift-F5 | kill all splits
bindkey "^[[31~" only                                   # shift-F5 | kill all splits
bindkey -k k6 detach                                    # F6  | Detach from this session
bindkey "^[[17;2~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach'   # shift-F6 | detach, but don't logout
bindkey "^[[32~" eval 'exec touch $BYOBU_RUN_DIR/no-logout' 'detach'    # shift-F6 | detach, but don't logout
bindkey "^[[17;5~" remove                               # ctrl-F6  | kill this split
                                                        # ctrl-F6  | sadly, does not work in tty :-(