dj95 / zjstatus

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

`ERROR IN PLUGIN` when running `action new-tab` #65

Closed cschmatzler closed 3 weeks ago

cschmatzler commented 3 weeks ago

Describe the bug When running zellij action new-tab with -l and -c set, zjstatus fails to start.

To Reproduce My settings:

config.kdl

default_shell "/opt/homebrew/bin/fish"
default_layout "zjstatus"
simplified_ui true
pane_frames false
theme "catppuccin-latte"
keybinds {
    normal {
        bind "Alt p" { 
            Run "/opt/homebrew/bin/fish" "-c" "$HOME/.scripts/open-project" {}
        }
    }
}

layouts/zjstatus.kdl

layout {
    pane split_direction="vertical" {
        children
    }
    pane size=1 borderless=true {
        plugin location="file:$HOME/.config/zellij/plugins/zjstatus.wasm" {
            format_left   "{mode} #[fg=#1e66f5,bold]{session}"
            format_center "{tabs}"
            format_right  "{datetime}"
            format_space  ""

            border_enabled  "false"
            border_char     "─"
            border_format   "#[fg=#6C7086]{char}"
            border_position "top"

            hide_frame_for_single_pane "true"

            mode_locked "#[fg=#dce0e8,bg=#e64553,bold] LOCKED "
            mode_normal "#[fg=#dce0e8,bg=#1e66f5,bold] NORMAL "
            mode_resize "#[fg=#dce0e8,bg=#179299,bold] RESIZE "
            mode_pane   "#[fg=#dce0e8,bg=#ea76cb,bold] PANE "
            mode_tab    "#[fg=#dce0e8,bg=#8839ef,bold] TAB "

            tab_normal   "#[fg=#1e66f5] {name} "
            tab_active   "#[fg=#8839ef,bold] {name} "

            datetime        "#[fg=#6C7086,bold] {format} "
            datetime_format "%A, %d %b %Y %H:%M"
            datetime_timezone "Europe/Berlin"
        }
    }
}

When running: zellij action new-tab -l zjstatus -c ~/Development/personal/turboprop/

The new tab is opened with the correct working directory, but zjstatus fails to start.

image

Interestingly, I cannot find any entry about this in the zellij logs.

Expected behavior zjstatus starts.

Screenshots See above.

Desktop (please complete the following information):

Layout

How does the layout look like? Please copy it into a code block.

See above.

Cheers

dj95 commented 3 weeks ago

Hi and thanks a lot for the detailed bug report. I think this is an error in zellij and not zjstatus.

When I try your layout, the following log lines appear when running the command.

Screenshot 2024-06-11 at 22 47 06

This hints at some inconsistent behaviour when resolving the $HOME environment variable.

If I test your layout with an absolute path or ~ instead of $HOME, it seems to work.

https://github.com/dj95/zjstatus/assets/4348959/876628e0-cde1-4b12-a9c6-9adf1d50aeec

Can you test this please?

cschmatzler commented 3 weeks ago

Hey @dj95, thanks for the swift reply! Replacing $HOME with ~ in the layout worked. I'll recreate this bug in the zellij repo then, sorry for misplacing it :)

dj95 commented 3 weeks ago

No worries, at first glance it looked like an issue in zjstatus. I'm glad that it works for you :) In addition, I addressed the issue and asked about it in the zellij discord.