Create independent sessions and open SSH sessions in adjacent tabs
Start new windows with a fresh shell and add explicit session selection through --attach. Route in-pane SSH launches back to the originating session, preserving remote shells and tab order across local detach and reattach.
This commit is contained in:
@@ -75,7 +75,11 @@ impl Zygote {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open_window(&mut self, remote: Option<String>) -> Result<()> {
|
||||
pub fn open_window(
|
||||
&mut self,
|
||||
remote: Option<String>,
|
||||
session: protocol::SessionTarget,
|
||||
) -> Result<()> {
|
||||
let executable = executable_path()?;
|
||||
let identity = ExecutableIdentity::read(&executable)?;
|
||||
let helper_exited = self.child.try_wait()?.is_some();
|
||||
@@ -89,6 +93,7 @@ impl Zygote {
|
||||
match self.request(&LaunchRequest::Launch {
|
||||
server_socket: self.server_socket.clone(),
|
||||
remote,
|
||||
session,
|
||||
})? {
|
||||
LaunchResponse::Launched { pid } => {
|
||||
log::info!("Forked psyTerm GUI {pid} from zygote {}", self.child.id());
|
||||
@@ -164,6 +169,7 @@ enum LaunchRequest {
|
||||
Launch {
|
||||
server_socket: PathBuf,
|
||||
remote: Option<String>,
|
||||
session: protocol::SessionTarget,
|
||||
},
|
||||
Shutdown,
|
||||
}
|
||||
@@ -222,6 +228,7 @@ pub fn run_zygote(socket: &Path) -> Result<()> {
|
||||
LaunchRequest::Launch {
|
||||
server_socket,
|
||||
remote,
|
||||
session,
|
||||
} => {
|
||||
if let Err(error) = ensure_single_threaded() {
|
||||
protocol::write_message(
|
||||
@@ -251,7 +258,7 @@ pub fn run_zygote(socket: &Path) -> Result<()> {
|
||||
drop(stream);
|
||||
drop(listener);
|
||||
let result = set_child_reaping(false)
|
||||
.and_then(|()| crate::run_gui(server_socket, remote));
|
||||
.and_then(|()| crate::run_gui(server_socket, remote, session));
|
||||
let code = if let Err(error) = result {
|
||||
log::error!("GUI startup failed: {error:#}");
|
||||
1
|
||||
|
||||
Reference in New Issue
Block a user