aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-01-15 09:07:03 +0100
committerGitHub <noreply@github.com>2026-01-15 09:07:03 +0100
commitf6584b0131c6db4b3cfbca0639b07838e69514c5 (patch)
tree12941c4b83a96228100cbe109a451cd0fc835512
parentfix: center floating panes when width/height but no x/y are provided (#4607) (diff)
downloadsl0ppij-f6584b0131c6db4b3cfbca0639b07838e69514c5.tar.gz
sl0ppij-f6584b0131c6db4b3cfbca0639b07838e69514c5.tar.xz
sl0ppij-f6584b0131c6db4b3cfbca0639b07838e69514c5.zip
fix: properly quit welcome screen when switching sessions (#4605)
* fix: properly quit welcome screen when switching sessions * fix tests and add PR to changelog
-rw-r--r--CHANGELOG.md2
-rw-r--r--default-plugins/session-manager/src/main.rs18
-rw-r--r--default-plugins/session-manager/src/new_session_info.rs17
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_plugin_command.snap9
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap9
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_plugin_command.snap9
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs10
-rw-r--r--zellij-server/src/route.rs2
8 files changed, 64 insertions, 12 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92dc3a15..81559a58 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,8 +24,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* feat: new `layout-manager` interface and plugin API commands (https://github.com/zellij-org/zellij/pull/4601)
* fix: keep serializing sessions resurrected from the welcome screen (https://github.com/zellij-org/zellij/pull/4604)
* fix: sanitize session names when deleting them from the CLI (https://github.com/zellij-org/zellij/pull/4583)
+* fix: properly close the welcome screen session when switching sessions away from it (https://github.com/zellij-org/zellij/pull/4605)
* fix: properly center floating panes started with `--floating` when explicit width/height is provided (https://github.com/zellij-org/zellij/pull/4607)
+
## [0.43.1] - 2025-08-08
* fix: pane rename backspace regression (https://github.com/zellij-org/zellij/pull/4346)
* fix: Zellij Web login issue with safari (https://github.com/zellij-org/zellij/pull/4345)
diff --git a/default-plugins/session-manager/src/main.rs b/default-plugins/session-manager/src/main.rs
index 5c014779..c89b0049 100644
--- a/default-plugins/session-manager/src/main.rs
+++ b/default-plugins/session-manager/src/main.rs
@@ -60,6 +60,7 @@ impl ZellijPlugin for State {
if self.is_welcome_screen {
self.active_screen = ActiveScreen::NewSession;
}
+ self.new_session_info.is_welcome_screen = self.is_welcome_screen;
subscribe(&[
EventType::ModeUpdate,
EventType::SessionUpdate,
@@ -529,11 +530,11 @@ impl State {
self.search_term.clear();
self.sessions
.update_search_term(&self.search_term, &self.colors);
- if !self.is_welcome_screen {
- // we usually don't want to hide_self() if we're the welcome screen because
- // unless the user did something odd like opening an extra pane/tab in the
- // welcome screen, this will result in the current session closing, as this is
- // the last selectable pane...
+ if self.is_welcome_screen {
+ // the welcome screen has done its job and now we need to quit this temporary
+ // session so as not to leave garbage sessions behind
+ quit_zellij();
+ } else {
hide_self();
}
},
@@ -542,6 +543,13 @@ impl State {
self.resurrectable_sessions.get_selected_session_name()
{
switch_session(Some(&session_name_to_resurrect));
+ if self.is_welcome_screen {
+ // the welcome screen has done its job and now we need to quit this temporary
+ // session so as not to leave garbage sessions behind
+ quit_zellij();
+ } else {
+ hide_self();
+ }
}
},
}
diff --git a/default-plugins/session-manager/src/new_session_info.rs b/default-plugins/session-manager/src/new_session_info.rs
index a6ff7901..cc8c4af0 100644
--- a/default-plugins/session-manager/src/new_session_info.rs
+++ b/default-plugins/session-manager/src/new_session_info.rs
@@ -8,6 +8,7 @@ pub struct NewSessionInfo {
name: String,
layout_list: LayoutList,
entering_new_session_info: EnteringState,
+ pub is_welcome_screen: bool,
pub new_session_folder: Option<PathBuf>,
}
@@ -106,10 +107,24 @@ impl NewSessionInfo {
match new_session_layout {
Some(new_session_layout) => {
let cwd = self.new_session_folder.as_ref().map(|c| PathBuf::from(c));
- switch_session_with_layout(new_session_name, new_session_layout, cwd)
+ switch_session_with_layout(new_session_name, new_session_layout, cwd);
+ if self.is_welcome_screen {
+ // the welcome screen has done its job and now we need to quit this temporary
+ // session so as not to leave garbage sessions behind
+ quit_zellij();
+ } else {
+ hide_self();
+ }
},
None => {
switch_session(new_session_name);
+ if self.is_welcome_screen {
+ // the welcome screen has done its job and now we need to quit this temporary
+ // session so as not to leave garbage sessions behind
+ quit_zellij();
+ } else {
+ hide_self();
+ }
},
}
}
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_plugin_command.snap
index b9528696..6e4cdfc8 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_plugin_command.snap
@@ -14,6 +14,13 @@ Some(
cwd: None,
},
1,
- None,
+ Some(
+ NotificationEnd {
+ channel: None,
+ exit_status: None,
+ unblock_condition: None,
+ affected_pane_id: None,
+ },
+ ),
),
)
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap
index a29aa181..4d7c327d 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap
@@ -20,6 +20,13 @@ Some(
),
},
1,
- None,
+ Some(
+ NotificationEnd {
+ channel: None,
+ exit_status: None,
+ unblock_condition: None,
+ affected_pane_id: None,
+ },
+ ),
),
)
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_plugin_command.snap
index ba0d9639..a87b04d7 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_plugin_command.snap
@@ -18,6 +18,13 @@ Some(
cwd: None,
},
1,
- None,
+ Some(
+ NotificationEnd {
+ channel: None,
+ exit_status: None,
+ unblock_condition: None,
+ affected_pane_id: None,
+ },
+ ),
),
)
diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs
index 82e4dabf..c50f33b5 100644
--- a/zellij-server/src/plugins/zellij_exports.rs
+++ b/zellij-server/src/plugins/zellij_exports.rs
@@ -4,7 +4,7 @@ use crate::global_async_runtime::get_tokio_runtime;
use crate::plugins::plugin_map::PluginEnv;
use crate::plugins::wasm_bridge::handle_plugin_crash;
use crate::pty::{ClientTabIndexOrPaneId, PtyInstruction};
-use crate::route::route_action;
+use crate::route::{route_action, wait_for_action_completion, NotificationEnd};
use crate::ServerInstruction;
use interprocess::local_socket::LocalSocketStream;
use log::warn;
@@ -18,6 +18,7 @@ use std::{
thread,
time::{Duration, Instant},
};
+use tokio::sync::oneshot;
use wasmi::{Caller, Linker};
use zellij_utils::data::{
CommandType, ConnectToSession, DeleteLayoutResponse, EditLayoutResponse, Event,
@@ -2059,6 +2060,9 @@ fn switch_session(
return Err(anyhow!("Failed to deserialize layout: {}", e));
}
}
+
+ let (completion_tx, completion_rx) = oneshot::channel();
+
if session_name
.as_ref()
.map(|s| s.contains('/'))
@@ -2079,9 +2083,11 @@ fn switch_session(
.send_to_server(ServerInstruction::SwitchSession(
connect_to_session,
client_id,
- None,
+ Some(NotificationEnd::new(completion_tx)),
))
.with_context(err_context)?;
+ let wait_forever = false;
+ let _ = wait_for_action_completion(completion_rx, "switch_session", wait_forever);
}
Ok(())
}
diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs
index f1c47dfa..df9fd305 100644
--- a/zellij-server/src/route.rs
+++ b/zellij-server/src/route.rs
@@ -45,7 +45,7 @@ pub struct ActionCompletionResult {
pub affected_pane_id: Option<PaneId>,
}
-fn wait_for_action_completion(
+pub fn wait_for_action_completion(
receiver: oneshot::Receiver<ActionCompletionResult>,
action_name: &str,
wait_forever: bool,