Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visible(true) event is not fired on plugin when session is reattached #2575

Open
h1romas4 opened this issue Jun 23, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@h1romas4
Copy link

Hello.

Basic information

zellij --version: zellij 0.37.2
stty size: 44 146
uname -av or ver(Windows): Linux thinkpad-p14s 5.19.0-45-generic #46~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jun 7 15:06:04 UTC 20 x86_64 x86_64 x86_64 GNU/Linux
alacritty --version: alacritty 0.12.1

Further information

The Visible(true) event to a plugin is fired when the session is first started, but the Visible(true) event is not fired when a Zellij session is detached-reattached.

Is it possible to change it so that the Visible(true) event is also fired on reattachment?

In the following example, the UI timer could not be started when detached-reattached a session.

fn update(&mut self, event: Event) -> bool {
    let mut render: bool = false;
    match event {
        Event::Visible(visible) => {
            // TODO:
            // If the Zellij session is detached, it is called with false,
            // but if it is reattached, this event is not fired.
            // Working on a way to restart the timer when it is reattached.
            if visible {
                set_timeout(0.0);
            }
            self.visible = visible;
        }
        Event::Timer(_t) => {
            // ..snip..
            render = true;
            if self.visible {
                set_timeout(INTERVAL_TIME);
            }
        }
        // ..snip..
    }
    render
}  

Reproduction

  1. Build example plugin and lauch (fisrt session)
git clone https://github.com/h1romas4/zellij-datetime
cd zellij-datetime
cargo build
zellij -l plugin.kdl

image

  1. Detach session (ctrl + o, d)

  2. reattach session

$ zellij list-sessions
automatic-payment
$ zellij attach automatic-payment

image

Best regards.

@h1romas4 h1romas4 added the bug Something isn't working label Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant