Why switch_session()
doesn't work?
#3329
-
I created the basic plugin: use zellij_tile::prelude::*;
use std::collections::BTreeMap;
#[derive(Default)]
struct State {}
register_plugin!(State);
impl ZellijPlugin for State {
fn load(&mut self, _configuration: BTreeMap<String, String>) {
switch_session(Some("existing-session"));
close_self();
}
fn update(&mut self, _event: Event) -> bool {
false
}
fn render(&mut self, _rows: usize, _cols: usize) {}
} But it doesn't actually switch to the existing session — it only closes itself. I tried putting it into the other two callbacks, but it didn't change anything. I'm trying to achieve what is described in #2448 (reply in thread). My only current "solution" is to start a new terminal with the desired zellij session (using an alias). The other "solution" would be to not run shell from the zellij by default, but that partially defeats the purpose of the multiplexer. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
the you need to request it in the |
Beta Was this translation helpful? Give feedback.
on linux I run
rm -rf $HOME/.cache/zellij
. I think on macos is somewhere in~/Library/Cache/zellij
, I can confirm tomorrow.I'm pretty sure in any of the 4 lifecycle methods (4th is the pipe one, documented in other section):
https://zellij.dev/documentation/plugin-lifecycle
Actually I don't think you would need to wait…