Config option for processes to ignore when confirming close #2677
Replies: 1 comment 2 replies
-
I think both of these suggestions are good improvements to the confirm close logic. I think both of them also likely involve parsing the process tree, or is there some other way I'm missing? If it is parsing the process tree, I suppose the next question is how it's doing this. "How" here is how its getting updates, now how its getting the tree. Since we own the process tree we should be able to easily use syscalls to get child information. But as far as I know, there isn't an evented way to get notification when new child processes start (there is a kqueue event when child processes end), so there must be some kind of polling happening here. If it is polling, the question I have is how often and under what conditions... |
Beta Was this translation helpful? Give feedback.
-
Ghostty's
confirm-close-surface
skips the close prompt by using shell integration to detect when you're at a prompt. I can see the motivation for this for the login shell, though it also means it'll skip the confirmation for subshells which may or may not be desired. But the problem here is it means it won't skip the prompt for anything that doesn't use the shell integration, either because it's an unsupported shell, or because it's running in a terminal multiplexer like tmux/zellij/screen.Terminal.app accomplishes this same "don't prompt at the shell" feature through a combination of two things:
screen
andtmux
but is configurable.That preference for other commands to ignore is the thing that I think would be nice to add to Ghostty (the "login shell" one also seems reasonable too for shells that don't support the shell integration). Having the option to skip terminal multiplexers is nice because closing the window doesn't lose that state, you can just reattach to it in a new window. Being able to include other processes that the user doesn't care about interrupting would be nice too. This does require knowing what processes are controlled by the terminal but I'm assuming that's not hard.
Footnotes
I'm not entirely sure how this detection is done. Opening a new window and letting
login
spawn the shell works. Opening a new window using a custom command and specifying the path to my login shell doesn't. Opening a new window using a custom command and specifying/bin/bash
does. In all 3 cases the shell is the child of thelogin
command. It's possible it's consulting/etc/shells
here for custom commands, since I didn't bother updating that with my shell. ↩Beta Was this translation helpful? Give feedback.
All reactions