aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2025-07-17 15:48:07 +0200
committerGitHub <noreply@github.com>2025-07-17 15:48:07 +0200
commit9fd7a020231d6f7f5ab2eb05dd213c47b58331f6 (patch)
tree742685ca3830c38655119d09f87ba09ad8241aad
parentfix(clipboard): reap process of external command (#4298) (diff)
downloadsl0ppij-9fd7a020231d6f7f5ab2eb05dd213c47b58331f6.tar.gz
sl0ppij-9fd7a020231d6f7f5ab2eb05dd213c47b58331f6.tar.xz
sl0ppij-9fd7a020231d6f7f5ab2eb05dd213c47b58331f6.zip
fix(web): change URL when renaming session (#4299)
* fix(web): change URL when renaming session * style(fmt): rustfmt
-rw-r--r--zellij-client/src/lib.rs3
-rw-r--r--zellij-client/src/web_client/server_listener.rs7
-rw-r--r--zellij-server/src/screen.rs14
-rw-r--r--zellij-utils/src/errors.rs1
-rw-r--r--zellij-utils/src/ipc.rs1
5 files changed, 24 insertions, 2 deletions
diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs
index 8bafcc74..60245f94 100644
--- a/zellij-client/src/lib.rs
+++ b/zellij-client/src/lib.rs
@@ -61,6 +61,7 @@ pub(crate) enum ClientInstruction {
QueryTerminalSize,
WriteConfigToDisk { config: String },
StartWebServer,
+ RenamedSession(String), // String -> new session name
}
impl From<ServerToClientMsg> for ClientInstruction {
@@ -86,6 +87,7 @@ impl From<ServerToClientMsg> for ClientInstruction {
ClientInstruction::WriteConfigToDisk { config }
},
ServerToClientMsg::StartWebServer => ClientInstruction::StartWebServer,
+ ServerToClientMsg::RenamedSession(name) => ClientInstruction::RenamedSession(name),
}
}
}
@@ -109,6 +111,7 @@ impl From<&ClientInstruction> for ClientContext {
ClientInstruction::QueryTerminalSize => ClientContext::QueryTerminalSize,
ClientInstruction::WriteConfigToDisk { .. } => ClientContext::WriteConfigToDisk,
ClientInstruction::StartWebServer => ClientContext::StartWebServer,
+ ClientInstruction::RenamedSession(..) => ClientContext::RenamedSession,
}
}
}
diff --git a/zellij-client/src/web_client/server_listener.rs b/zellij-client/src/web_client/server_listener.rs
index 458e314b..04ad6e04 100644
--- a/zellij-client/src/web_client/server_listener.rs
+++ b/zellij-client/src/web_client/server_listener.rs
@@ -142,6 +142,13 @@ pub fn zellij_server_listener(
WebServerToWebClientControlMessage::LogError { lines },
);
},
+ Some((ServerToClientMsg::RenamedSession(new_session_name), _)) => {
+ client_connection_bus.send_control(
+ WebServerToWebClientControlMessage::SwitchedSession {
+ new_session_name,
+ },
+ );
+ },
_ => {
// server disconnected, stop trying to listen otherwise we retry
// indefinitely and get 100% CPU
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index 29dd10bd..44089237 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -5113,9 +5113,19 @@ pub(crate) fn screen_thread_main(
.with_context(err_context)?;
// set the env variable
- set_session_name(name);
+ set_session_name(name.clone());
+ screen.unblock_input()?;
+ let connected_client_ids: Vec<ClientId> =
+ screen.active_tab_indices.keys().copied().collect();
+ for client_id in connected_client_ids {
+ if let Some(os_input) = &mut screen.bus.os_input {
+ let _ = os_input.send_to_client(
+ client_id,
+ ServerToClientMsg::RenamedSession(name.clone()),
+ );
+ }
+ }
}
- screen.unblock_input()?;
},
ScreenInstruction::Reconfigure {
client_id,
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 836b5100..10eed658 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -478,6 +478,7 @@ pub enum ClientContext {
QueryTerminalSize,
WriteConfigToDisk,
StartWebServer,
+ RenamedSession,
}
/// Stack call representations corresponding to the different types of [`ServerInstruction`]s.
diff --git a/zellij-utils/src/ipc.rs b/zellij-utils/src/ipc.rs
index a9e374f2..2ec6d8d5 100644
--- a/zellij-utils/src/ipc.rs
+++ b/zellij-utils/src/ipc.rs
@@ -116,6 +116,7 @@ pub enum ServerToClientMsg {
QueryTerminalSize,
WriteConfigToDisk { config: String },
StartWebServer,
+ RenamedSession(String), // String -> new session name
}
#[derive(Serialize, Deserialize, Debug, Clone)]