Is there a way to implement something like screen's zombies in tmux?

18 views
Skip to first unread message

Morgan, Iain (ARC-TNC)[InuTeq, LLC]

unread,
May 22, 2026, 12:34:32 PMMay 22
to tmux-...@googlegroups.com
Hi,

Currently, I use a hook to call "confirm respawn-pane" when the command in the pane has terminated. That works fine in cases where I want to respawn the pane, but I'd like tmux to kill the pane if I do not select to respawn it.

Essentially, if I enter "y" at the confirmation prompt, I want to respawn the pane, but I want the pane to be killed if I enter 'n." Is there a way to do this in version 2.7 or 3.2a?

Thanks,

--
Iain Morgan


Nicholas Marriott

unread,
May 22, 2026, 1:15:49 PMMay 22
to Morgan, Iain (ARC-TNC)[InuTeq, LLC], tmux-...@googlegroups.com
Instead of using confirm use a custom prompt. This works for master, I can't tell you about 3.2, you may have to adapt it:

set -g remain-on-exit on
set-hook -g pane-died {
    command-prompt -1p 'Respawn pane #{pane_id}?' "if -F '#{m/r:[Yy],%1}' 'respawnp' 'killp'"
}



--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/98027AD2-A8CE-438A-A4E7-31C5A53EEDEC%40nasa.gov.

Morgan, Iain (ARC-TNC)[InuTeq, LLC]

unread,
May 26, 2026, 4:12:27 PMMay 26
to Nicholas Marriott, tmux-...@googlegroups.com
Thanks for putting me on the right track. With some slight adjustment, I managed to get this to work for both 3.2a and 2.7.

set -g remain-on-exit on
set-hook -g pane-died "command-prompt -1p 'Respawn pane? (y/n)' \
\"if -F '#{m:[Yy],%1}' respawn-pane kill-pane\""

--
Iain

On 5/22/26, 10:15, "Nicholas Marriott" wrote:

Instead of using confirm use a custom prompt. This works for master, I can't tell you about 3.2, you may have to adapt it:




set -g remain-on-exit on
set-hook -g pane-died {
command-prompt -1p 'Respawn pane #{pane_id}?' "if -F '#{m/r:[Yy],%1}' 'respawnp' 'killp'"
}










On Fri, 22 May 2026 at 17:34, 'Morgan, Iain (ARC-TNC)[InuTeq, LLC]' via tmux-users <tmux-...@googlegroups.com <mailto:tmux-...@googlegroups.com> <mailto:tmux-...@googlegroups.com <mailto:tmux-...@googlegroups.com>>> wrote:


Hi,


Currently, I use a hook to call "confirm respawn-pane" when the command in the pane has terminated. That works fine in cases where I want to respawn the pane, but I'd like tmux to kill the pane if I do not select to respawn it.


Essentially, if I enter "y" at the confirmation prompt, I want to respawn the pane, but I want the pane to be killed if I enter 'n." Is there a way to do this in version 2.7 or 3.2a?


Thanks,


--
Iain Morgan




--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com <mailto:tmux-users+...@googlegroups.com> <_blank>.
To view this discussion, visit https://groups.google.com/d/msgid/tmux-users/98027AD2-A8CE-438A-A4E7-31C5A53EEDEC%40nasa.gov <https://groups.google.com/d/msgid/tmux-users/98027AD2-A8CE-438A-A4E7-31C5A53EEDEC%40nasa.gov> <_blank>.









Reply all
Reply to author
Forward
0 new messages