zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
19.38k stars 610 forks source link

bug: session-manager session doesn't get cleaned up when resurrecting a session #3410

Open cristiand391 opened 3 weeks ago

cristiand391 commented 3 weeks ago

2. Issues with the Zellij UI / behavior / crash

Issue description

I start zellij with the welcome layout in alacritty like this:

[shell]
program = "/home/cristiand391/.local/bin/zellij"
args = ["-l", "welcome"]

when I create or attach to a new session I see the session where welcome layout lives being deleted after I'm on the new session (which is intended). If I instead resurrect a session I can see the session containing the welcome layout still alive.

Minimal reproduction

  1. start zellij with the welcome layout as mentioned above
  2. check the session name of the welcome layout, then resurrect a session
  3. on the resurrected session, launch session-manager and see the previous session in the Attach to session tab.

Other relevant information

zellij --version: zellij 0.40.1

cristiand391 commented 3 weeks ago

It seems the session gets cleared for the AttachToSession tab beacuse it runs hide_self right after switching to the new session: https://github.com/zellij-org/zellij/blob/56baf0b13dfc177a095ae9b3267fe531d4453099/default-plugins/session-manager/src/main.rs#L483C1-L494C29

I tested a few layouts launching just zj-quit and when pressing Esc (which runs hide_self too) the session gets deleted so that could explain the current behaviour (calling hide_self on the only pane kills its session). Not sure if this was a hack (maybe calling kill_sessions would kill the zellij instance if it happened before the session switch call above) or an unintended side-effect.

Happy to open a PR if maintainers agree the current behavior is unintended.