diff --git a/doc/terminator.1 b/doc/terminator.1 index f028933e..fbc066fb 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -221,8 +221,14 @@ Decrease font size. \fBNote:\fP This may require you to press shift, depending o .B Ctrl+Zero (0) Restore font size to original setting. .TP -.B Alt+T -Rename titlebar. +.B Ctrl+W +Rename window title. +.TP +.B Ctrl+A +Rename tab title. +.TP +.B Ctrl+X +Rename terminal title. .TP .B Super+1 Insert terminal number, i.e. 1 to 12. diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index f27eb428..3a50b561 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -286,6 +286,18 @@ Note that 1 may need to be provided as ! or similar, depending on your keyboard layout. Default value: \fBUnbound\fR .TP +.B edit_window_title +Edit the current active window's title +Default value: \fBW\fR +.TP +.B edit_tab_title +Edit the currently active tab's title +Default value: \fBA\fR +.TP +.B edit_terminal_title +Edit the currently active terminal's title +Default value: \fBX\fR +.TP .B full_screen Toggle the window to a fullscreen window. Default value: \fBF11\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index b77d3feb..41443c60 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -192,7 +192,9 @@ DEFAULTS = { 'broadcast_all' : 'a', 'insert_number' : '1', 'insert_padded' : '0', - 'edit_window_title': 't', + 'edit_window_title': 'w', + 'edit_tab_title' : 'a', + 'edit_terminal_title': 'x', 'layout_launcher' : 'l', 'next_profile' : '', 'previous_profile' : '', diff --git a/terminatorlib/editablelabel.py b/terminatorlib/editablelabel.py index 9e05714b..7091e0aa 100644 --- a/terminatorlib/editablelabel.py +++ b/terminatorlib/editablelabel.py @@ -25,7 +25,8 @@ class EditableLabel(Gtk.EventBox): # pylint: disable-msg=R0904 """ An eventbox that partialy emulate a Gtk.Label - On double-click, the label is editable, entering an empty will revert back to automatic text + On double-click or key binding the label is editable, entering an empty + will revert back to automatic text """ _label = None _ebox = None @@ -67,30 +68,34 @@ class EditableLabel(Gtk.EventBox): """get the text from the label""" return(self._label.get_text()) + def edit(self): + """ Start editing the widget text """ + if self._entry: + return False + self.remove (self._label) + self._entry = Gtk.Entry () + self._entry.set_text (self._label.get_text ()) + self._entry.show () + self.add (self._entry) + sig = self._entry.connect ("focus-out-event", self._entry_to_label) + self._entry_handler_id.append(sig) + sig = self._entry.connect ("activate", self._on_entry_activated) + self._entry_handler_id.append(sig) + sig = self._entry.connect ("key-press-event", + self._on_entry_keypress) + self._entry_handler_id.append(sig) + sig = self._entry.connect("button-press-event", + self._on_entry_buttonpress) + self._entry_handler_id.append(sig) + self._entry.grab_focus () + def _on_click_text(self, widget, event): # pylint: disable-msg=W0613 """event handling text edition""" if event.button != 1: return False if event.type == Gdk.EventType._2BUTTON_PRESS: - if self._entry: - return False - self.remove (self._label) - self._entry = Gtk.Entry () - self._entry.set_text (self._label.get_text ()) - self._entry.show () - self.add (self._entry) - sig = self._entry.connect ("focus-out-event", self._entry_to_label) - self._entry_handler_id.append(sig) - sig = self._entry.connect ("activate", self._on_entry_activated) - self._entry_handler_id.append(sig) - sig = self._entry.connect ("key-press-event", - self._on_entry_keypress) - self._entry_handler_id.append(sig) - sig = self._entry.connect("button-press-event", - self._on_entry_buttonpress) - self._entry_handler_id.append(sig) - self._entry.grab_focus () + self.edit() return(True) return(False) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 54bef799..27990f19 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -536,6 +536,9 @@ class TabLabel(Gtk.HBox): else: return(None) + def edit(self): + self.label.edit() + def update_button(self): """Update the state of our close button""" if not self.config['close_button_on_tab']: diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 832fe8d7..278df423 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -147,6 +147,8 @@ class PrefsEditor: 'insert_number' : _('Insert terminal number'), 'insert_padded' : _('Insert padded terminal number'), 'edit_window_title': _('Edit window title'), + 'edit_terminal_title': _('Edit terminal title'), + 'edit_tab_title' : _('Edit tab title'), 'layout_launcher' : _('Open layout launcher window'), 'next_profile' : _('Switch to next profile'), 'previous_profile' : _('Switch to previous profile'), diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 6f445405..d42af16c 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1884,6 +1884,20 @@ class Terminal(Gtk.VBox): dialog.destroy() return + def key_edit_tab_title(self): + window = self.get_toplevel() + if not window.is_child_notebook(): + return + + notebook = window.get_children()[0] + n_page = notebook.get_current_page() + page = notebook.get_nth_page(n_page) + label = notebook.get_tab_label(page) + label.edit() + + def key_edit_terminal_title(self): + self.titlebar.label.edit() + def key_layout_launcher(self): LAYOUTLAUNCHER=LayoutLauncher()