-
-
Notifications
You must be signed in to change notification settings - Fork 787
Description
If I have multiple panes/tabs open, quitting loses my layout. Similarly, if I have running processes, quitting terminates them. This is also true for closing tabs or panes.
By contrast, tmux prompts for all of these (when invoked via default keybinds). It also doesn't even have a default bind for kill-session
(instead offering a bind for "detach"). This makes it very hard to accidentally lose work in tmux. And the easiest way to kill panes in tmux is to exit the process running in it (and killing windows is typically done by killing all panes).
I think zellij has the opportunity to strike a middle ground here. Here's my suggestions:
-
Like macOS Terminal.app, Zellij could have a notion of "processes that are okay to close without confirmation". Terminal.app always includes your login shell in that list, and by default includes "screen" and "tmux" (presumably because those can detach and resume later). Zellij would preferably have a config entry for processes to use.
Until such time as Zellij has a way to override preferences on a per-preference basis, it should probably omit screen/tmux from the list (and the login shell would always be included even with an empty list).
-
When using a default keybind to close a pane, it should prompt if the pane includes processes other than what's in step 1.
-
When using a default keybind to close a tab, it should prompt if any pane in the tab would need a prompt.
-
When using a default keybind to quit zellij, it should prompt if any tab would need a prompt.
The close prompts would ideally identify any processes that are the reason for the prompt (again, this is something that Terminal.app does), though just saying it will "close running processes" is acceptable.
Zellij should support also actions to bypass the confirm prompt, for use in custom keybinds for people who want it. A few suggestions, ordered by my aesthetic preference:
- action: [SkipConfirm: Quit,] # or [SkipConfirm: [Quit]]
- action: [QuitWithoutConfirm]
- action: [Quit: NoConfirm]
There's also the inverse, e.g. ConfirmBeforeQuit
as the default, but this means anyone who's already customized their keybinds won't get the confirmations.
Additional thoughts
Experimentally, I believe macOS Terminal.app's notion of "login shell" is "any entry in /etc/shells that is the direct child of the root login
instance for the tab" (meaning running exec login -f $USER
from the shell requires a prompt before closing as the process list is now login > login > shell).
One possible way to override preferences on a per-preference basis is to have a special entry for "the default value". Something like ${default}
or ${inherited}
(inherited would make sense if zellij ever supports including one config file in another, because then you can build your config in layers). This way the config could be something like skipClosePromptForProcesses: ["${inherited}", myCustomShell]
.