feat(keybindings): support multiple modifiers (eg. Ctrl+Alt) and the kitty keyboard protocol #3383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR represents the first stage in solving the "colliding keys" problem faced by many users - meaning that the default Zellij keys collide with many of their favorite applications running inside Zellij, forcing them to configure the keys or to constantly lock and unlock the Zellij UI.
This PR helps solve this issue by drastically expanding the range of bindable keys, adding multiple modifiers as well as previously unsupported modifiers such as
Super
. Before the next release, additional changes will be made - building on top of this - to provide defaults (for any terminal and OS, whether supporting this protocol or not) that will make this problem go away.The main user facing changes here are:
Ctrl Alt a
)Super
key in supported terminalsCtrl Alt Home
,Alt Shift Super Insert
, whatever you can imagine)Opt
should work asAlt
out of the boxImplementation details:
Key
data structure was swapped forKeyWithModifier
to better represent keys with multiple modifiers (this also affets the Rust SDK, see below)Breaking Change for (Rust) plugin developers:
While as always plugins compiled for the previous versions of Zellij should still work, plugins wishing to use the new Rust SDK will encounter the following change:
The
Key
structure was swapped forKeyWithModifier
to account for keys possibly having multiple modifiers (and new modifiers, eg.Super
). Supporting methods were added to figure out which modifiers a key has so that plugins can more easily match against them.This should not affect other plugin SDKs, seeing as the contract (the protobuf key representation) only had modifiers added to it and was not changed in any way. Depending on their implementation, other SDK authors might need to update their data structures to match this change.
Configuration
Support for the kitty keyboard protocol can be explicitly disabled through configuration by setting
support_kitty_keyboard_protocol false
in the config file or when launching Zellij through the CLI. If disabled, Zellij will not request this encoding on startup, will not request it to be removed on shut down and will not encode it to terminal apps running inside its panes when they request it. It will however reply to support queries from such apps, letting them know there is no support.