You are not logged in.
HI. As the title says: I want to get a prompt in Terminator (a terminal emulator) if I accidentally try to close its window while a process is active inside it. Eg.: If I have vim open inside terminator, and I carelessly press the window manager's close button, I want a prompt asking for confirmation.
Now there was a sane default by which it automatically showed such a prompt, but I (quite stupidly) told it to never prompt me again. Later I wanted it back. But I couldn't find where or how I could change that preference. I have tried going through its "Preferences" gui and also searched its default config file:
~/.config/terminator/configbut I have had no luck. I have also checked DConf Editor by searching for 'term', 'terminal' and 'terminator'. Again no luck.
I was hoping someone here could tell me how I could fix it. Currently I have resorted to running a screen session, so that I don't lose my work. But I hope I can get that prompt back.
Thank you.
Last edited by richcocoa (2013-10-14 08:29:31)
Offline
It's possible to obtain this prompt when trying to close multiple tabs / terminals / windows. I've made some modifications to my /usr/share/terminator/terminatorlib/container.py based on the Launchpad version. The construct_confirm_close function makes it possible:
def construct_confirm_close(self, window, reqtype):
"""Create a confirmation dialog for closing things"""
# skip this dialog if applicable
if self.config['suppress_multiple_term_dialog']:
return gtk.RESPONSE_ACCEPT
dialog = gtk.Dialog(_('Close?'), window, gtk.DIALOG_MODAL)
dialog.set_has_separator(False)
dialog.set_resizable(False)
dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
c_all = dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT)
c_all.get_children()[0].get_children()[0].get_children()[1].set_label(
_('Close _Terminals'))
primary = gtk.Label(_('<big><b>Close multiple terminals?</b></big>'))
primary.set_use_markup(True)
primary.set_alignment(0, 0.5)
secondary = gtk.Label(_('This %s has several terminals open. Closing \
the %s will also close all terminals within it.') % (reqtype, reqtype))
secondary.set_line_wrap(True)
labels = gtk.VBox()
labels.pack_start(primary, False, False, 6)
labels.pack_start(secondary, False, False, 6)
image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_WARNING,
gtk.ICON_SIZE_DIALOG)
image.set_alignment(0.5, 0)
box = gtk.HBox()
box.pack_start(image, False, False, 6)
box.pack_start(labels, False, False, 6)
dialog.vbox.pack_start(box, False, False, 12)
checkbox = gtk.CheckButton(_("Do not show this message next time"))
dialog.vbox.pack_end(checkbox)
dialog.show_all()
result = dialog.run()
# set configuration
self.config.base.reload()
self.config['suppress_multiple_term_dialog'] = checkbox.get_active()
self.config.save()
dialog.destroy()
return(result)Paired with suppress_multiple_term_dialog in your ~/.config/terminator/config:
[global_config]
...
suppress_multiple_term_dialog = False
...Most I could find at this time in the morning.
Offline
Thanks a ton Reddington. I will post back with my results in some time.
By the way, how did you find it out? Are you a dev on the Terminator team? Or did you just go through the source code? What I want to know is how I could have found that tidbit easily if I knew where the files were... (I knew where the files installed to. But in my case they are in /usr/lib/python2.7/site-packages/terminatorlib ) Hence the question.
Anyway thanks for answering.
Offline
Not a problem!
I hope all works well for you. And if I were a dev, I'd be screwed because this is like the second time I've used Terminator. First thing I did was take a look at my own files. Then the config in terminatorlib from this Ohloh repository. You can click on the mysterious option (suppress_multiple_term_dialog is on line 109) and it will show you the instance in the "container.py" source. I knew where the function was, and there was definitely pieces missing in my version of the code after looking over theirs.
I kind of figured it would be in a different location for you, but I wasn't too sure where as I'm on Knoppix at the moment.
I hope this cleared up a few things as much as I could. If you have any further questions, or need further clarification, I'm totally here.
Offline