Open nickma82 opened 3 years ago
Some of the features you are talking about are already implemented.
If there is more than one terminal, Terminator will prompt you if you really want to close multiple terminals.
If you don't see this happening, go to ~/.config/terminator/config
and delete this line:
suppress_multiple_term_dialog = True
Now, if you only have one terminal open, there is an hack you can do to make Ctrl+D not close the terminal. I guess you want only one terminal to be kept alive (allowing the ones you create by splitting to be closed).
If you prefer editing the config file, then open it and duplicate the [[default]]
profile (or the name of the profile you use). Now you should have something like this:
[profiles]
[[default]]
...
...
[[default]]
...
...
Change the name of the second profile to dont-close
or similar and add three lines at the end of it:
exit_action = restart
use_custom_command = True
custom_command = zsh
Now go to preferences, Layout. Select your layout (probably default
). Select the Terminal in the list and change its Profile to dont-close.
And... done! Now the first terminal you open will not be closed by Ctrl+D
Open preferences, go to Profiles, Add a new one.
On the new profile, go to the Command sub-menu, check Run a custom command...
and write the name of your shell. Also change the value of When command exits
to Restart the command
.
Now go to preferences, Layout. Select your layout (probably default
). Select the Terminal in the list and change its Profile to dont-close.
By using this method, you also have to manually copy the settings from the old profile to the new one.
That's just an hack, not a "clean" way of doing it, but it should work for Ctrl+D at least. To close Terminator, Alt+f4 or the X button will still work without a prompt. Coding it should not be too hard for us.
You could also just set "restart the command" in the "Command" tab on the default profile. It will close the shell, but it'll leave the terminator window so that you can open a new tab, or split the window/
For any other method, a customization of https://github.com/gnome-terminator/terminator/issues/496#issuecomment-906743133 will work nicely.
For this, I'd like to set it so that restart the command actually restarts the shell. Right now, the shell just prints exit and stdout says:
Traceback (most recent call last):
File "/home/mattrose/Code/terminator/terminatorlib/terminal.py", line 1541, in spawn_child
result, self.pid = self.vte.spawn_sync(Vte.PtyFlags.DEFAULT,
TypeError: Item 3: Must be bytes, not Terminal
Somehow, a Terminal object is put inside the "args" variable (line 1520, terminal.py). Also, the reason I didn't suggest this is that Terminator won't split after the shell is dead. I get a bunch of log errors.
This is what I get if I print the args:
['/bin/zsh', '/bin/zsh', '-c', <Vte.Terminal object at 0x7f6ed518adc0 (VteTerminal at 0x21c75d0)>]
The order of the parameters was messed up.
- def spawn_child(self, init_command=None, widget=None, respawn=False, debugserver=False):
+ def spawn_child(self, widget=None, respawn=False, debugserver=False, init_command=None):
The first one should always be the widget, for gtk signals, I think.
As you said in your response, I think the proper response to this is two-fold, triggered by one config option.
Might not be too bad.
Is your feature request related to a problem? Please describe. Terminator is my Nr.1 terminal frontend. I'm using it for hours every day and I never ever close it unless I want a new kernel getting loaded. However, from time to time (like a couple of minutes ago) I accidentally close it; I immediately go "NOOOOO". And I which for something I'd never wish for any other app: A prompt before closing.
Describe the solution you'd like A prompt before exit, with the ability to cancel it.
Describe alternatives you've considered
Best