zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
21.69k stars 657 forks source link

Add Win key modifier key. #2886

Open blank2121 opened 1 year ago

blank2121 commented 1 year ago

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

Raizo62 commented 9 months ago

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.

alonz commented 8 months ago

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

ivanrg99 commented 6 days ago

@alonz has the new update broken this setup for you?