zjstatus icon indicating copy to clipboard operation
zjstatus copied to clipboard

is there a way to reload configuration?

Open svonjoi opened this issue 10 months ago • 4 comments

Description

I have multiple sessions with tabs and each tab has zjstatus. Every time I change zjstatus configuration, I have to recreate each tab of each session to apply new changes

Is there a way to reload plugin configuration inside loaded layout?

Layout configuration

layout {
    default_tab_template {
        children
        pane size=2 borderless=true {
            plugin location="file:~/.config/zellij/plugins/zjstatus.wasm" {
                format_left  "{mode}#[bg=#0e0a1b,fg=#adad88] {session} "
                format_center "#[bg=#0e0a1b,fg=#adad88] {swap_layout} "
                format_right "{tabs} "
                format_space  "#[bg=#0e0a1b]"

                //mode_locked  "#[bg=red,fg=white]  LOCKED "
                mode_locked  "#[bg=red,fg=white]  "
                mode_normal  "#[bg=#adad88] "
                mode_tmux    "#[bg=#E5BD1A] "
                mode_pane    "#[bg=#1AE5AB] "
                mode_resize    "#[bg=#1AE5AB] "
                mode_move    "#[bg=#1AE5AB] "
                mode_tab    "#[bg=#1AE5AB] "
                mode_scroll    "#[bg=#1AE5AB] "
                mode_search    "#[bg=#1AE5AB] "
                mode_entersearch    "#[bg=#1AE5AB] "
                mode_renametab    "#[bg=#1AE5AB] "
                mode_renamepane    "#[bg=#1AE5AB] "
                mode_session    "#[bg=#1AE5AB] "

                tab_normal "#[bg=#0e0a1b,fg=#adad88] {name} {sync_indicator}{fullscreen_indicator}{floating_indicator}#[bg=#adad88,fg=black]"
                tab_active "#[bg=#adad88,fg=#0e0a1b] {name} {sync_indicator}{fullscreen_indicator}{floating_indicator}#[bg=black,fg=#adad88]"

                tab_sync_indicator       "󰓦 "
                tab_fullscreen_indicator "󰉈 "
                tab_floating_indicator   "‡ "

                hide_frame_except_for_scroll "true"

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

                datetime          "{format}"
                datetime_format   "%d-%m-%Y %H:%M"
                datetime_timezone "Europe/Berlin"
            }
        }
    }

    tab name="~" focus=true {
        //pane size="1" cwd="/home/svonjoi/"
        pane size="1" cwd="~"
    }
}

svonjoi avatar Feb 14 '25 16:02 svonjoi

I tried the following but didn't work:

zellij action start-or-reload-plugin file:~/.config/zellij/plugins/zjstatus.wasm

results in zjstatus error "no configuration found"

Image

svonjoi avatar Feb 14 '25 16:02 svonjoi

Hi :)

I don't think there's a way to reload it, unfortunately. But this is a limitation within zellij. There are two ways to configure zjstatus: layouts and plugin aliases in the config.

When a session is created, it won't reload the layout file, if it changes, as this would break the existing panes.

The configuration is (at least partly) hot reloaded. Unfortunately it does not seem to reload the config for plugins. With the plugin manager (default bind Ctrl-o p), I tried to reload it after changing the config, but it did not work.

Your idea by reloading it with the zellij action command is good, but it tries to spin up a new instance instead of reloading the current ones. I'm not sure though, how to target specific running instances with it.

May I ask, if you could please open the issue on the zellij side? Feel free to also link this one to the one in zellij. As soon as zellij would allow reloading a changed plugin configuration, it will also work in zjstatus. Otherwise I don't really see a way to properly build a configuration reload because of the WASM sandbox, zjstatus cannot access arbitrary files and therefore need to rely on the configuration provided by zellij.

dj95 avatar Feb 14 '25 18:02 dj95

When a session is created, it won't reload the layout file, if it changes, as this would break the existing panes.

https://github.com/zellij-org/zellij/issues/3833#issuecomment-2661038662

svonjoi avatar Feb 15 '25 18:02 svonjoi

hey!

Your idea by reloading it with the zellij action command is good, but it tries to spin up a new instance instead of reloading the current ones. I'm not sure though, how to target specific running instances with it.

also related https://github.com/zellij-org/zellij/issues/3993

svonjoi avatar Feb 15 '25 18:02 svonjoi