Merge lp:~hdaniel/terminator/terminator into lp:terminator/trunk

Proposed by Haim Daniel
Status: Merged
Merged at revision: 1683
Proposed branch: lp:~hdaniel/terminator/terminator
Merge into: lp:terminator/trunk
Diff against target: 166 lines (+59/-19)
7 files modified
doc/terminator.1 (+6/-0)
doc/terminator_config.5 (+8/-0)
terminatorlib/config.py (+2/-0)
terminatorlib/editablelabel.py (+24/-19)
terminatorlib/notebook.py (+3/-0)
terminatorlib/prefseditor.py (+2/-0)
terminatorlib/terminal.py (+14/-0)
To merge this branch: bzr merge lp:~hdaniel/terminator/terminator
Reviewer Review Type Date Requested Status
Stephen Boddy Approve
Review via email: mp+274807@code.launchpad.net

Commit message

Add support for terminal edit title key binding.

Description of the change

Currently the only way of changing either: terminal title and tab title is by mouse clicking on either on them.

The suggested fix adds support for keybinding for each action and has a potential productivity increase.

The suggested default key layouts are:
* edit terminal title '<Alt>F2'.
* edit tab title '<Alt><Shift>F2'

This fixes issue: https://bugs.launchpad.net/terminator/+bug/1417747

To post a comment you must log in.
Revision history for this message
Haim Daniel (hdaniel) wrote :

bump. anyone ?

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Hi, I'm aware. I just haven't gotten around to merging it. A couple of minor comments/nitpicks.

1) I'm not sure about the suggested shortcuts. We use Alt+T to change the window title, and to use F2 now for titlebars and tabs feels a bit "ad-hoc" :-) I need to have a think whether I should move the window shortcut so that they are gathered together. (I don't think we can move yours to the T key, as that is already quite busy with shortcuts.

2) From a simple eyeball, the patch looks good, but I notice that nothing was added to the documents (man pages, manual etc.) It's not a huge deal, and I can add it myself, but it would be nice if these non-code items are updated too.

Thanks for the contribution, and I will test and merge it soon.

Revision history for this message
Haim Daniel (hdaniel) wrote :

Hi,

Regarding 1)
perfectly understood and agreed - the suggested key combination was just a temp placeholder :)

regarding 2) will add the shortcuts to the relevant documentation, but IMHO "1)" should be decided upon ? or I can simply add current patch's keys and later on modify them ?

Thank you for you time and a great SW piece!

lp:~hdaniel/terminator/terminator updated
1675. By Haim Daniel <email address hidden>

Add support for terminal and tab edit title key binding.

Currently the only way of changing either active terminal title or active tab
title is by mouse clicking on them.

The suggested fix adds support for keybinding for each action, thus providing
a potential productivity increase from user's perspective.

The suggested default key layouts are:
* edit terminal title '<Alt>F2'.
* edit tab title '<Alt><Shift>F2'

This fixes issue: https://bugs.launchpad.net/terminator/+bug/1417747

Revision history for this message
Haim Daniel (hdaniel) wrote :

bump.

I'm sorry for being so pesky, but is there an issue with the patch which I can resolve ?

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Nope. The only problem is my free time, and what I'm doing with it. I had a bit of a push when getting the 0.98 release out, so my foot has been off the gas. Don't worry, I'm just a cyclical maintainer. I'll have a burst of activity at some point soon, and it'll get merged.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

So it is now merged as rev 1683. Thanks for the contribution.

I did adjust the shortcuts in the end. I don't know about you, but on my desktop <Alt>+F2 gives me the "Run Application" dialog. So they are now
<Ctrl>W for /W/indow
<Ctrl>A for t/A/b
<Ctrl>X for terminal (/X/ marks the spot :-)

I updated the man pages and the html manual too.

review: Approve
Revision history for this message
Haim Daniel (hdaniel) wrote :

Great. My 5 cents are: <Ctrl>W is bound to remove word on bash (which is kinda popular shell), IMHO it will cause some users tear their hairs ...

Revision history for this message
Haim Daniel (hdaniel) wrote :

I wasn't able to edit prev comment, but <Ctrl>A is home in bash as well:
http://ss64.com/bash/syntax-keyboard.html

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Yeah, someone raised a bug about this:
https://bugs.launchpad.net/terminator/+bug/1514089

Let's continue discussion of appropriate shortcuts there.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doc/terminator.1'
2--- doc/terminator.1 2015-10-01 18:51:28 +0000
3+++ doc/terminator.1 2015-10-26 13:47:38 +0000
4@@ -224,6 +224,12 @@
5 .B Alt+T
6 Rename titlebar.
7 .TP
8+.B Alt+F2
9+Rename terminal title.
10+.TP
11+.B Alt+Shift+F2
12+Rename tab title.
13+.TP
14 .B Super+1
15 Insert terminal number, i.e. 1 to 12.
16 .TP
17
18=== modified file 'doc/terminator_config.5'
19--- doc/terminator_config.5 2015-10-01 18:53:15 +0000
20+++ doc/terminator_config.5 2015-10-26 13:47:38 +0000
21@@ -286,6 +286,14 @@
22 depending on your keyboard layout.
23 Default value: \fBUnbound\fR
24 .TP
25+.B edit_tab_title
26+Edit the currently active tab's title
27+Default value: \fB<Alt><Shift>F2\fR
28+.TP
29+.B edit_terminal_title
30+Edit the currently active terminal's title
31+Default value: \fB<Alt>F2\fR
32+.TP
33 .B full_screen
34 Toggle the window to a fullscreen window.
35 Default value: \fBF11\fR
36
37=== modified file 'terminatorlib/config.py'
38--- terminatorlib/config.py 2015-10-01 18:53:15 +0000
39+++ terminatorlib/config.py 2015-10-26 13:47:38 +0000
40@@ -191,6 +191,8 @@
41 'insert_number' : '<Super>1',
42 'insert_padded' : '<Super>0',
43 'edit_window_title': '<Alt>t',
44+ 'edit_tab_title' : '<Alt><Shift>F2',
45+ 'edit_terminal_title': '<Alt>F2',
46 'layout_launcher' : '<Alt>l',
47 'next_profile' : '',
48 'previous_profile' : '',
49
50=== modified file 'terminatorlib/editablelabel.py'
51--- terminatorlib/editablelabel.py 2015-07-10 19:36:33 +0000
52+++ terminatorlib/editablelabel.py 2015-10-26 13:47:38 +0000
53@@ -26,7 +26,8 @@
54 # pylint: disable-msg=R0904
55 """
56 An eventbox that partialy emulate a gtk.Label
57- On double-click, the label is editable, entering an empty will revert back to automatic text
58+ On double-click or key binding the label is editable, entering an empty
59+ will revert back to automatic text
60 """
61 _label = None
62 _ebox = None
63@@ -69,30 +70,34 @@
64 """get the text from the label"""
65 return(self._label.get_text())
66
67+ def edit(self):
68+ """ Start editing the widget text """
69+ self.remove(self._label)
70+ self._entry = gtk.Entry()
71+ self._entry.set_text(self._label.get_text())
72+ self._entry.show()
73+ self.add(self._entry)
74+ sig = self._entry.connect("focus-out-event", self._entry_to_label)
75+ self._entry_handler_id.append(sig)
76+ sig = self._entry.connect("activate", self._on_entry_activated)
77+ self._entry_handler_id.append(sig)
78+ sig = self._entry.connect("key-press-event",
79+ self._on_entry_keypress)
80+ self._entry_handler_id.append(sig)
81+ sig = self._entry.connect("button-press-event",
82+ self._on_entry_buttonpress)
83+ self._entry_handler_id.append(sig)
84+ self._entry.grab_focus()
85+
86 def _on_click_text(self, widget, event):
87 # pylint: disable-msg=W0613
88 """event handling text edition"""
89 if event.button != 1:
90 return False
91 if event.type == gtk.gdk._2BUTTON_PRESS:
92- self.remove (self._label)
93- self._entry = gtk.Entry ()
94- self._entry.set_text (self._label.get_text ())
95- self._entry.show ()
96- self.add (self._entry)
97- sig = self._entry.connect ("focus-out-event", self._entry_to_label)
98- self._entry_handler_id.append(sig)
99- sig = self._entry.connect ("activate", self._on_entry_activated)
100- self._entry_handler_id.append(sig)
101- sig = self._entry.connect ("key-press-event",
102- self._on_entry_keypress)
103- self._entry_handler_id.append(sig)
104- sig = self._entry.connect("button-press-event",
105- self._on_entry_buttonpress)
106- self._entry_handler_id.append(sig)
107- self._entry.grab_focus ()
108- return(True)
109- return(False)
110+ self.edit()
111+ return True
112+ return False
113
114 def _entry_to_label (self, widget, event):
115 # pylint: disable-msg=W0613
116
117=== modified file 'terminatorlib/notebook.py'
118--- terminatorlib/notebook.py 2015-09-07 02:03:24 +0000
119+++ terminatorlib/notebook.py 2015-10-26 13:47:38 +0000
120@@ -536,6 +536,9 @@
121 else:
122 return(None)
123
124+ def edit(self):
125+ self.label.edit()
126+
127 def update_button(self):
128 """Update the state of our close button"""
129 if not self.config['close_button_on_tab']:
130
131=== modified file 'terminatorlib/prefseditor.py'
132--- terminatorlib/prefseditor.py 2015-10-01 18:53:15 +0000
133+++ terminatorlib/prefseditor.py 2015-10-26 13:47:38 +0000
134@@ -148,6 +148,8 @@
135 'insert_number' : _('Insert terminal number'),
136 'insert_padded' : _('Insert padded terminal number'),
137 'edit_window_title': _('Edit window title'),
138+ 'edit_terminal_title': _('Edit terminal title'),
139+ 'edit_tab_title' : _('Edit tab title'),
140 'layout_launcher' : _('Open layout launcher window'),
141 'next_profile' : _('Switch to next profile'),
142 'previous_profile' : _('Switch to previous profile'),
143
144=== modified file 'terminatorlib/terminal.py'
145--- terminatorlib/terminal.py 2015-10-01 18:53:15 +0000
146+++ terminatorlib/terminal.py 2015-10-26 13:47:38 +0000
147@@ -1836,6 +1836,20 @@
148 dialog.destroy()
149 return
150
151+ def key_edit_tab_title(self):
152+ window = self.get_toplevel()
153+ if not window.is_child_notebook():
154+ return
155+
156+ notebook = window.get_children()[0]
157+ n_page = notebook.get_current_page()
158+ page = notebook.get_nth_page(n_page)
159+ label = notebook.get_tab_label(page)
160+ label.edit()
161+
162+ def key_edit_terminal_title(self):
163+ self.titlebar.label.edit()
164+
165 def key_layout_launcher(self):
166 LAYOUTLAUNCHER=LayoutLauncher()
167