-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
Support multiple modifier keys #735
Comments
Unfortunately I'm not 100% sure this is possible within the terminal emulator landscape we're working in. It's not just a question of how we store or configure the keys, but also a question of how we serialize/deserialize them from/to stdin. This is an issue I've hit several times and have not yet had a chance to fully investigate. I think most terminal emulators won't differentiate between a ctrl-j and a ctrl-alt-j, for example. There really is a limited amount of things we can do here. If you (or someone else) would like to investigate this more, I'd be happy to give some pointers. |
There are actually multiple solutions in terminal emulators:
|
Thanks @klamonte for this great information!! Being a multiplexer, I guess we would ideally have to support all of these. I'm very open to this change, but this seems like a bit of a tall order (especially since we're using Termion to parse stdin and unless I'm mistaken I don't think they support any of these specifications). Do you have any information about which one of these is the most common? |
Start with PC-style function keys. I'm seeing support with xterm, wezterm, gnome-terminal, konsole, kitty, and alacritty at the least, which is quite a bit of coverage. It's also something that anything intending to work with TERM=xterm should support, since it is default behavior for xterm. |
I've got a bunch of CTRL-ALT-whatever keys mapped on my keyboard to use with my editor. As described above they aren't working. No new info from me, just marking that there's at least two folks in the world who have the issue. Given that number, I wouldn't expect this to make it up the priority list. (Which I completely understand) Next step for me is to move to to single modifiers. Leaving this as a note for anyone else who stumbles across it. |
I'm trying to adapt my terminator shortcuts (.i.e.: "ctrl + shift + o" for horizontal splitting) so that I don't have to learn a new routine, does that mean it's impossible right now? 😢 edit: ok, using alacritty I can send a command 👍 key_bindings:
|
What's the status of this right now, if I may? As it stands Zellij breaks a lot of my existing commands for neovim. Edit: worth noting the workaround of |
I am running into the same issue when combining neovim with zellij. |
Also running into this issue while using helix inside of zellij, as there are some shortcuts that use ctrl. The ctrl+g workaround mentioned by @ethanmsl works well enough for now, but it would be great if I could use a Meh key modifier combo in place of ctrl for zellij inputs. Or if that isn't possible, maybe another mode that would allow us to use the alt bindings for navigation while the ctrl bindings are locked, like the way they are in the interface locked mode? |
I'm not completely sure if this would work for you, but my current approach for this is adding these keybindings in my config: Details
|
https://github.com/crossterm-rs/crossterm supports kitty keyboard protocol, but replace termion with crossterm maybe too much work |
If I'm not wrong, Zellij uses termwiz which does seem to support both CsiU & Kitty protocol: https://docs.rs/termwiz/latest/termwiz/input/enum.KeyboardEncoding.html |
I am a long time user of tiling window managers as well as tmux, and my muscle memory is dead set on resizing with Ctrl + Alt + {h,j,k,l}, so I trip every time I need to resize in zellij. I don't know what libraries and stuff zellij uses, but they can't be that limiting can they...? |
Hey :) I'm willing to put in the time to implement this, but I would need a bit of guidance to know where to look. For what I've gathered zellij uses termwiz now and it should be a matter of adding the handling of whatever escape sequences are to be supported; right? |
I used Emacs in the terminal, I had to use EDIT: thanks to @mkon , #735 (comment). Now I can use zellij without a problem. |
Same problem here: I actually can't use Zellij just because I can't bind |
I use the |
This issue needs love, this is literally the only thing stopping me from adopting zellij |
Agreed. I use Tmux, which has a similar issue Possible regression: tmux silently swallows extended keys · Issue #2705 · tmux/tmux. This makes a lot of programs unusable. The issue seems rather stagnant. If Zellij fixes this issue, I'd immediately switch to it. Tmux and Zellij are the only modern terminal multiplexers I know of. |
Friends - respectfully: please do not add comments to this issue (or any other issue, really) saying that you want/need this. It doesn't help and mostly serves to demotivate me. I don't think this is the desired goal. Thanks, |
Is there any PR or branch where work has been started? I could take a look and maybe do some testing. If not, then maybe I could hack around and see if it is easy to add support for multiple modifier keys. Hints and tips for project testing are appreciated. |
Hi. There is no branch, it is not easy and reviewing a PR for this will take me longer than implementing it myself. I realize you really want this, but please be patient and see my previous comment. Thank you. |
Fair enough. Thanks for the work you're doing. Feel free to ping if you need extra test subjects ;D |
My workaround for this for anyone interested: Essentially in your terminal, you can bind key combinations to PUS escape codes, example in alacritty:
Then in zellij you can bind these key codes, replacing the defaults. Then there should be no more collisions. You just have to press this combination when editing the config and it will insert these characters, but the binding will work. It will look something like this probably, maybe a bit different depending on the font you use:
I essentially use Command+Alt+(P,T,O,...) and Command+Arrows to move. Don't even have to use Locking. |
I apologize on behalf of everyone, Please don't feel rushed. If anyone is interested in a similar solution to the above for
Then in zellij I have bound F11 and F12 to a couple of things. |
My solution is to set it to Locked mode by default, then I modified the zellij code to prohibit input in Normal mode, and then configured the following key mapping:
In this way, zellij becomes a terminal multiplexer similar to VIM mode. diff --git a/zellij-utils/src/input/keybinds.rs b/zellij-utils/src/input/keybinds.rs
index ab13f71..822e665 100644
--- a/zellij-utils/src/input/keybinds.rs
+++ b/zellij-utils/src/input/keybinds.rs
@@ -47,7 +47,7 @@ impl Keybinds {
}
pub fn default_action_for_mode(&self, mode: &InputMode, raw_bytes: Vec<u8>) -> Action {
match *mode {
- InputMode::Normal | InputMode::Locked => Action::Write(raw_bytes),
+ InputMode::Locked => Action::Write(raw_bytes),
InputMode::RenameTab => Action::TabNameInput(raw_bytes),
InputMode::RenamePane => Action::PaneNameInput(raw_bytes),
InputMode::EnterSearch => Action::SearchInput(raw_bytes),
|
I took @mkon's approach, but I'm using home manger to generate both wezterm: config.keys = {
{key="p", mods="CTRL|SHIFT", action=wezterm.action.SendString("@ctrl_shift_p@")}, zellij:
...where the Without home-manager the entries for wezterm would be like:
This breaks the user-facing hotkey strings. It would be an even nicer workaround if I could just set them explicitly, but I'm happy enough with it 🙂 . |
I attempted your workaround on Kitty but some for weird reason, Zellij seems to be registering the commands twice. For example, when I try to open a new tab, it creates two tabs instead of one.
|
EDIT: I had comments of the PUA Unicode (for easy reference) on the same line as the mapping in my |
I was looking around for a way to do multiple modifier keys for an action and was unable to find any in configuration files or documentation. After doing a little digging, it looks like it's not currently supported, as keys are stored at
zellij-tile::data::Key
and doesn't have an option for multiple modifier keys. One solution could be to changeKeys
to be a struct rather than an enum and have fields for modifiers and key values.This might cause some issues with other language keyboards if they have different modifier keys (maybe composition keys?), but for a US keyboard, I believe these are the only modifier keys:
For storing multiple modifiers, I believe either using the bitfield crate (https://crates.io/crates/bitfield) or a struct of bools would work.
Supporting multiple modifiers will also require changes the the configuration file format.
I'm not sure what would be the best way to represent a keybind, but something like this could work:
The text was updated successfully, but these errors were encountered: