dj95 / zjstatus

A configurable statusbar plugin for zellij
MIT License
435 stars 9 forks source link

git commands not working #21

Closed arpangreat closed 11 months ago

arpangreat commented 11 months ago

git command doesn't show up in the status bar. ( config as readme is used )

dj95 commented 11 months ago

Hey,

Im afraid you need to give some more information. E.g. which zellij version you use, which operating system do you use? Which zjstatus version? Is there any other config? Where do you start zellij? Is it in a git repo? What is your expected behavior? What is the actual behavior?

Simply saying "it doesn't work" won't help when reporting a bug.

arpangreat commented 11 months ago

Sorry my fault;

zellij version: zellij 0.39.0 zjstatus version: the latest 0.9.0 release OS: Linux 6.5.9-zen2-1-zen

there is no other config , my layout config is

layout {
    // pane split_direction="vertical" {
    //     pane
    // }

  pane size=1 borderless=true {
    plugin location="file:/home/arpangreat/dotfiles/zellij/plugins/zjstatus.wasm" {
      format_left  "#[fg=#9ece6a,italic]{mode}  #[fg=#9ece6a,bold]{tabs}"
      format_right "{command_git_branch} #[fg=#1abc9c,bold]{session}"
      format_space ""

      command_branch_command   "echo  "
      command_branch_format    "#[fg=blue] {stdout} "
      command_branch_interval  "10"

      command_git_branch_command   "git rev-parse --abbrev-ref HEAD"
      command_git_branch_format    "#[fg=blue] {stdout} "
      command_git_branch_interval  "2"

      tab_normal   "{index}  "
      tab_active   "{index}* "

      mode_normal        "#[fg=#b8bb26,bold]{name}"
      mode_locked        "#[fg=#fb4934,bold]{name}"
      mode_resize        "#[fg=#fabd2f,bold]{name}"
      mode_pane          "#[fg=#d3869b,bold]{name}"
      mode_tab           "#[fg=#83a598,bold]{name}"
      mode_scroll        "#[fg=#8ec07c,bold]{name}"
      mode_session       "#[fg=#fe8019,bold]{name}"
      mode_move          "#[fg=#a89984,bold]{name}"

      hide_frame_for_single_pane "true"
    }
  }
    pane
}

expected behaviour is obviously seeing the branch name ( HEAD ) as such in the left side of status bar, but unfortunately there is no such element there

20231108_00h50m57s_grim

also I like to add, yes this is in a git repo

dj95 commented 11 months ago

Thanks a lot for the information and sorry for the rough words.

Can you please change the following line

      command_git_branch_format    "#[fg=blue] {stdout} "

to

      command_git_branch_format    "#[fg=blue] {exit_code} {stdout} {stderr} "

This way we can see if the command is executed and if it fails.


I used your layout and on my side it seems to work.

Screenshot 2023-11-07 at 20 33 14
arpangreat commented 11 months ago

sorry for the rough words.

Nah mate, It was my fault not providing any info. It's late mid night here so I was in a rush

Anyway , It works now if I startup zellij in git repo but if I initialize zellij in shell on startup using the default script provided by zellij sh zellij setup --generate-auto-start zsh , It doesn't update the output and stays on error output i.e. no git repository. no matter if I'm cd into git repo or not.

dj95 commented 11 months ago

That explains the issue. The plugin is always started in the directory you start zellij. It won't update based on the pane you're currently working in, since it won't have access there unfortunately.

Hope you enjoy zellij and zjstatus either way. In the next days, I'll take some time to write more documentation and a debugging guide / faq, such that it will be more clear. Happy hacking!

arpangreat commented 11 months ago

Thanks for writing this plugin and yeah! maybe in future as the both zellij and zjstatus become more stabilize we could see such feature.

Thanks again!

nbari commented 4 months ago

That explains the issue. The plugin is always started in the directory you start zellij. It won't update based on the pane you're currently working in, since it won't have access there unfortunately.

Hope you enjoy zellij and zjstatus either way. In the next days, I'll take some time to write more documentation and a debugging guide / faq, such that it will be more clear. Happy hacking!

Hi @dj95 this still an issue with zellij 0.40.1 ?

dj95 commented 4 months ago

Hi @nbari ,

yes, this is still a thing since it is by zellijs design. I'm currently thinking about adding a pipe command, such that you can change the cwd for a command widget on the fly.