zellij-org / zellij

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

Visual button for Quit visible in locked mode when disabled #3455

Open vincentqb opened 6 days ago

vincentqb commented 6 days ago

I've disabled the Quit keyboard shortcut, as below.

keybinds clear-defaults=true {
    locked {
        bind "Ctrl g" { SwitchToMode "Normal"; }
    }
    shared_except "locked" {
        bind "Ctrl g" { SwitchToMode "Locked"; }
        // bind "Ctrl q" { Quit; }
        bind "Alt n" { NewPane; }
        bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
        bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
        bind "Alt j" "Alt Down" { MoveFocus "Down"; }
        bind "Alt k" "Alt Up" { MoveFocus "Up"; }
        bind "Alt =" "Alt +" { Resize "Increase"; }
        bind "Alt -" { Resize "Decrease"; }
    }
...
}

As desired, the <> Quit visual button disappears from the bar. But not from the locked mode bar, see images below.

zellij_locked zellij_unlocked

Is that intentional or it should also be hidden from there? Thanks!

zellij --version: zellij 0.40.1

Zykino commented 6 days ago

Yeah, un-commenting does not `unbind. There are 3 possibilities that I know of:

  1. unbind the shortcut
  2. Override it (if I remember correctly you can do with: bind "Ctrl q" { })
  3. Read (and do) as the first line of the first line of the dumped config tells you to (the commented one ;) )
vincentqb commented 6 days ago

I've tried to un/comment lines with "Ctrl q" without success. Is that what you meant?

keybinds clear-defaults=true {
    unbind "Ctrl q"
    locked {
        bind "Ctrl g" { SwitchToMode "Normal"; }
        bind "Ctrl q" { }
    }
    shared_except "locked" {
        bind "Ctrl g" { SwitchToMode "Locked"; }
        // bind "Ctrl q" { Quit; }
        bind "Alt n" { NewPane; }
        bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
        bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
        bind "Alt j" "Alt Down" { MoveFocus "Down"; }
        bind "Alt k" "Alt Up" { MoveFocus "Up"; }
        bind "Alt =" "Alt +" { Resize "Increase"; }
        bind "Alt -" { Resize "Decrease"; }
    }
...
}

The keyboard settings from the default configuration from zellij setup --dump-config are very close to mine otherwise :) Is that what you meant in 3? Thanks again!

Zykino commented 5 days ago

Yeah, it one ore or the other :sweat_smile: Just the clear-defaults=true should be enough if you ends up dumping and configuring your config from there. Note that zellij does not reload its config. You will have to start another session to get the new bindings.

For the option 1: you did override, but not "inplace", so I’m not sure it will work.

vincentqb commented 5 days ago

Just to be clear, I have the keyboard bindings working :) I'm really just talking about the little visual Quit icon that remains in locked mode despite not representing any binding. That icon is successfully removed when unlocked. I attached images to the issue to emphasize what I mean. :) Thanks again!

Zykino commented 4 days ago

Oh! I did not understood that! Yeah I have the same "glitch". Never noticed in a year of usage :sweat_smile: Thanks for reporting.

I think the underlying issue is that this bar’s shortcut’s presentation is more or less hardcoded. Like I moved the Quit action to only be activated when I’m on the "session mode". If I try to set it to only q then it is still shown in the first bar instead of the second one (like <d> Detach is).