dj95 / zjstatus

A configurable statusbar plugin for zellij
MIT License
358 stars 6 forks source link

💅 Improve non normal mode configuration #36

Closed bphenriques closed 5 months ago

bphenriques commented 5 months ago

Is your feature request related to a problem? Please describe. For me, I do not need a visual indicator when I am in normal mode but I do want in other modes. However, to do that, I need to actually setup each mode as it defaults to mode_normal. This leads to some duplication in the config and perhaps a bit brittle if more modes appear. It is not a huge problem for me because I generate using nix but could be cleaner:

let 
  ...
  # https://zellij.dev/documentation/keybindings-modes.html
  nonNormalModes = ["locked" "resize" "pane" "move" "tab" "scroll" "search" "entersearch" "renametab" "renamepane" "session" "tmux"];
in
''
...
     pane size=1 borderless=true {
        plugin location="file:${pkgs.zjstatus}/bin/zjstatus.wasm" {
             ${lib.concatMapStringsSep "\n" (mode: ''mode_${mode} "#[bg=${green},fg=${black}] {name} "'') nonNormalModes}
        }
     }
...
''

Which lets me create the following visual: Normal:

image

Non-Norma:

image

Describe the solution you'd like Not sure as I do not know the code-base. More intuitive (perhaps not for others), would be to have a mode_non_normal. The behaviour would be:

Additional context N/A

dj95 commented 5 months ago

Hey,

thanks a lot for the feedback! I've implemented the config key mode_default_to_mode, which is able to override the default to normal to a specific other mode. E.g. with mode_default_to_mode "tmux" the format of the tmux mode will be used for unconfigured modes.