Add kitty keyboard protocol support for zellij
I had to add the following lines in ble/term/modifyOtherKeys/.update function to make kitty keyboard protocol work in zellij.
(zellij:*)
method=modifyOtherKeys
[[ $bleopt_term_modifyOtherKeys_passthrough_kitty_protocol ]] &&
method=kitty_keyboard_protocol ;;
It seems simple enough, but I'm not sure if this is the full story. Is it possible to add this support in the upstream?
OK, Zellij doesn't seem to support modifyOtherKeys (as its CSI dispatch doesn't cover the case where the intermediate > is present with the final byte being m), while it seems to recognize kitty's keyboard protocol.
It seems simple enough, but I'm not sure if this is the full story.
Did you test this in your environment?
(zellij:*) method=modifyOtherKeys [[ $bleopt_term_modifyOtherKeys_passthrough_kitty_protocol ]] && method=kitty_keyboard_protocol ;;
Since Zellij directly supports kitty's keyboard protocol, this should simply be
(zellij:*)
method=kitty_keyboard_protocol ;;
Would this cause issue if the terminal that runs zellij does not support kitty keyboard protocol?
I've tested in Ghostty with your changes (always using method=kitty_keyboard_protocol), and keybindings seem to work both with support_kitty_keyboard_protocol on and off (although only shift-enter is susceptible in my config).
Would this cause issue if the terminal that runs zellij does not support kitty keyboard protocol?
As Zellij supports enabling/disabling the kitty keyboard protocol, it is natural to guess that Zellij translates the input key sequences from the outer terminal by setting up the mode of the outer terminal (which can in principle be the kitty keyboard protocol, modifyOtherKeys, fixterms, or any other keyboard protocols) appropriately. If it doesn't, that means that enabling/disabling the kitty keyboard protocol in Zellij is a no-op, which is strange, though I haven't checked the actual implementation and the behavior of Zellij.
Also, the option term_modifyOtherKeys_passthrough_kitty_protocol should be disabled for the present case. That option is used to trick the multiplexer. When the multiplexer does not support the kitty keyboard protocol, the option is used to bypass the multiplexer and forcibly change the mode of the outer terminal by mangling the enabling/disabling sequence. Inside Zellij, since Zellij supports the kitty keyboard protocol, the kitty keyboard protocol of the outer terminal should be managed by Zellij and should not be directly changed by ble.sh.
That said, currently, ble.sh doesn't support the outer-terminal detection and the passthrough sequence inside Zellij, so term_modifyOtherKeys_passthrough_kitty_protocol wouldn't change the behavior currently.
I added the setting in commit 6cffa910.
@allpan3 Could you test the master branch and confirm it correctly enables detailed keyboard inputs (such as ctrl-enter, which you mentioned)?
Yes it works both in Ghostty and Zellij. Thanks!
Thanks!