diff --git a/mux/src/domain.rs b/mux/src/domain.rs index 6f69cc233..7d8268678 100644 --- a/mux/src/domain.rs +++ b/mux/src/domain.rs @@ -271,6 +271,12 @@ impl Domain for LocalDomain { let pane_id = alloc_pane_id(); cmd.env("WEZTERM_PANE", pane_id.to_string()); + let command_description = format!( + "\"{}\" in domain \"{}\"", + cmd.as_unix_command_line() + .unwrap_or_else(|err| format!("error rendering command line: {:?}", err)), + self.name + ); let child = pair.slave.spawn_command(cmd)?; log::trace!("spawned: {:?}", child); @@ -293,6 +299,7 @@ impl Domain for LocalDomain { child, pair.master, self.id, + command_description, )); let mux = Mux::get().unwrap(); diff --git a/mux/src/localpane.rs b/mux/src/localpane.rs index 0f631806a..1b182d6c2 100644 --- a/mux/src/localpane.rs +++ b/mux/src/localpane.rs @@ -56,6 +56,7 @@ pub struct LocalPane { domain_id: DomainId, tmux_domain: RefCell>>, proc_list: RefCell>, + command_description: String, } #[async_trait(?Send)] @@ -142,9 +143,10 @@ impl Pane for LocalPane { let mut proc = self.process.borrow_mut(); let mut notify = None; - const EXIT_BEHAVIOR: &str = "\x1b]8;;https://wezfurlong.org/wezterm/\ - config/lua/config/exit_behavior.html\ - \x1b\\exit_behavior\x1b]8;;\x1b\\"; + const EXIT_BEHAVIOR: &str = "This message is shown because \ + \x1b]8;;https://wezfurlong.org/wezterm/\ + config/lua/config/exit_behavior.html\ + \x1b\\exit_behavior\x1b]8;;\x1b\\"; match &mut *proc { ProcessState::Running { @@ -162,7 +164,8 @@ impl Pane for LocalPane { (ExitBehavior::Close, _, _) => *proc = ProcessState::Dead, (ExitBehavior::CloseOnCleanExit, false, false) => { notify = Some(format!( - "\r\n[Process didn't exit cleanly. ({}=\"CloseOnCleanExit\")]\r\n", + "\r\n⚠️ Process {} didn't exit cleanly.\r\n{}=\"CloseOnCleanExit\"\r\n", + self.command_description, EXIT_BEHAVIOR )); *proc = ProcessState::DeadPendingClose { killed: false } @@ -171,13 +174,13 @@ impl Pane for LocalPane { (ExitBehavior::Hold, success, false) => { if success { notify = Some(format!( - "\r\n[Process completed. ({}=\"Hold\")]\r\n", - EXIT_BEHAVIOR + "\r\n👍Process {} completed.\r\n{}=\"Hold\"\r\n", + self.command_description, EXIT_BEHAVIOR )); } else { notify = Some(format!( - "\r\n[Process didn't exit cleanly. ({}=\"Hold\")]\r\n", - EXIT_BEHAVIOR + "\r\n⚠️ Process {} didn't exit cleanly.\r\n{}=\"Hold\"\r\n", + self.command_description, EXIT_BEHAVIOR )); } *proc = ProcessState::DeadPendingClose { killed: false } @@ -732,6 +735,7 @@ impl LocalPane { process: Box, pty: Box, domain_id: DomainId, + command_description: String, ) -> Self { let (process, signaller, pid) = split_child(process); @@ -753,6 +757,7 @@ impl LocalPane { domain_id, tmux_domain: RefCell::new(None), proc_list: RefCell::new(None), + command_description, } } diff --git a/mux/src/ssh.rs b/mux/src/ssh.rs index 622f852e9..1302b5923 100644 --- a/mux/src/ssh.rs +++ b/mux/src/ssh.rs @@ -656,7 +656,14 @@ impl Domain for RemoteSshDomain { writer, ); - let pane: Rc = Rc::new(LocalPane::new(pane_id, terminal, child, pty, self.id)); + let pane: Rc = Rc::new(LocalPane::new( + pane_id, + terminal, + child, + pty, + self.id, + "RemoteSshDomain".to_string(), + )); let mux = Mux::get().unwrap(); mux.add_pane(&pane)?; diff --git a/mux/src/tmux_commands.rs b/mux/src/tmux_commands.rs index ed76f189d..aa625b632 100644 --- a/mux/src/tmux_commands.rs +++ b/mux/src/tmux_commands.rs @@ -154,6 +154,7 @@ impl TmuxDomainState { Box::new(child), Box::new(pane_pty), self.domain_id, + "tmux pane".to_string(), )); let tab = Rc::new(Tab::new(&size));