Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugins): rebind keys at runtime #3422

Merged
merged 8 commits into from
Jun 14, 2024
Merged

feat(plugins): rebind keys at runtime #3422

merged 8 commits into from
Jun 14, 2024

Conversation

imsnif
Copy link
Member

@imsnif imsnif commented Jun 14, 2024

This PR allows plugins to rebind a user's keys.

Context

This PR builds on #3383 and is intended to solve the colliding keybindings issue that has plagued many Zellij users, forcing them to rebind specific keys that collided for them in the Zellij configuration (or in the relevant apps).

This PR lays down the foundation for the next PR, which will include different sets of keys that could be easily switched to at runtime in some sort of wizard or configuration window. These sets of keys will have "something for everyone", giving users the ability to quickly choose the right set of non-colliding keys that work for them (but of course also by default providing the current "Zellij Classic Keybindings" experience so that users who are happy with the status-quo - which is most users - will not feel any change).

Technical Changes

  1. Keys and input modes are now interpreted on the Zellij server-side rather than the Zellij client-side. This is to allow plugins (that run on the server) to rebind these keys at runtime. The client-side now only interprets the STDIN ANSI instructions, encoding them into keys and sending them to the server.
  2. A new rebind_keys plugin API command was added behind a new RebindKeys permission that the user has to grant plugins so that they can run this command. The command accepts a string that follows the same rules as the keybindings configuration file. Rust example:
rebind_keys("
    keybinds {
        locked {
            bind \"a\" { NewTab; }
        }
    }
".to_owned());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant