From e5eda24a218b82979d27cf009e6b210127390188 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Tue, 26 Jun 2012 20:29:54 +0200 Subject: [PATCH] Add shortcut (no default) to edit window title. --- terminatorlib/config.py | 3 ++- terminatorlib/prefseditor.py | 3 ++- terminatorlib/terminal.py | 31 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 30e6ebcf..3b0c6d77 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -161,7 +161,8 @@ DEFAULTS = { 'new_terminator' : 'i', 'broadcast_off' : '', 'broadcast_group' : '', - 'broadcast_all' : '' + 'broadcast_all' : '', + 'edit_window_title': '' }, 'profiles': { 'default': { diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 3869012d..8267893f 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -126,7 +126,8 @@ class PrefsEditor: 'new_terminator' : 'Spawn a new Terminator process', 'broadcast_off' : 'Don\'t broadcast key presses', 'broadcast_group' : 'Broadcast key presses to group', - 'broadcast_all' : 'Broadcast key events to all' + 'broadcast_all' : 'Broadcast key events to all', + 'edit_window_title': 'Edit window title' } def __init__ (self, term): diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index dd58fd9a..5b97e248 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1634,6 +1634,37 @@ class Terminal(gtk.VBox): def key_broadcast_all(self): self.set_groupsend(None, self.terminator.groupsend_type['all']) + def key_edit_window_title(self): + window = self.get_toplevel() + dialog = gtk.Dialog(_('Rename Window'), window, + gtk.DIALOG_MODAL, + ( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, + gtk.STOCK_OK, gtk.RESPONSE_ACCEPT )) + dialog.set_default_response(gtk.RESPONSE_ACCEPT) + dialog.set_has_separator(False) + dialog.set_resizable(False) + dialog.set_border_width(8) + + label = gtk.Label(_('Enter a new title for the Terminator window...')) + name = gtk.Entry() + name.set_activates_default(True) + if window.title.text != self.vte.get_window_title(): + name.set_text(self.get_toplevel().title.text) + + dialog.vbox.pack_start(label, False, False, 6) + dialog.vbox.pack_start(name, False, False, 6) + + dialog.show_all() + res = dialog.run() + if res == gtk.RESPONSE_ACCEPT: + if name.get_text(): + window.title.force_title(None) + window.title.force_title(name.get_text()) + else: + window.title.force_title(None) + dialog.destroy() + return + # End key events gobject.type_register(Terminal)