zellij icon indicating copy to clipboard operation
zellij copied to clipboard

Add Win key modifier key.

Open blank2121 opened this issue 1 year ago • 1 comments

I use arch linux and I use my Alt key for my windows and my main controls for my setup. So i was disappointed when I saw that Zellij did not have Win as one of the modifier keys. If there is a specific reason that is not supported then I want to hear why but if not it would be great to have all 3: Ctrl, Alt, Win.

Furthermore, I was looking through the code and found the file that looks to be in control of the keys and i saw the modifier key struct and think that it could just be added like how i did in the comments:

 #[repr(i32)]
    pub enum KeyModifier {
        Ctrl = 0,
        Alt = 1,
        // Win = 2,
    }
    impl KeyModifier {
        pub fn as_str_name(&self) -> &'static str {
            match self {
                KeyModifier::Ctrl => "CTRL",
                KeyModifier::Alt => "ALT",
                // KeyModifier::Win => "WIN",
            }
        }
        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
            match value {
                "CTRL" => Some(Self::Ctrl),
                "ALT" => Some(Self::Alt),
                //  "WIN" => Some(Self::Win),
                _ => None,
            }
        }
    }

The original code is here

blank2121 avatar Oct 22 '23 17:10 blank2121

I guess the reason is here :

Hey, these will not work with Zellij because we read input from STDIN rather than from your keyboard directly. Since STDIN does not know about these keys, we cannot bind them.

Raizo62 avatar Jan 23 '24 14:01 Raizo62

My solution for this was just to use the terminal (wezterm in my case) mapping instead of zellij so I've kept zellij default mapping and mapped CMD to perform whatever action I needed, for example

{
    key = "t",
    mods = "CMD",
    action = act.Multiple({
        act.SendKey({ key = "t", mods = "CTRL" }),
       act.SendKey({ key = "n" }),
    }),
},

https://wezfurlong.org/wezterm/config/lua/keyassignment/Multiple.html

alonz avatar Mar 15 '24 15:03 alonz