Merge lp:~stephen-j-boddy/terminator/feature-change-window-title into lp:terminator/trunk

Proposed by Stephen Boddy
Status: Merged
Merged at revision: 1312
Proposed branch: lp:~stephen-j-boddy/terminator/feature-change-window-title
Merge into: lp:terminator/trunk
Diff against target: 69 lines (+35/-2)
3 files modified
terminatorlib/config.py (+2/-1)
terminatorlib/prefseditor.py (+2/-1)
terminatorlib/terminal.py (+31/-0)
To merge this branch: bzr merge lp:~stephen-j-boddy/terminator/feature-change-window-title
Reviewer Review Type Date Requested Status
Chris Jones (community) Approve
Review via email: mp+112187@code.launchpad.net

Description of the change

I can have many instances of terminator open at once. My task bar starts to become very confusing. I frequently get to a point where I just have a bunch of windows with my username at the bottom of the screen, and lose track of which is which.

This patch defines an optional shortcut that asks for a new title, and then sets it as per the -T FORCEDTITLE command line option. Entering a blank string reverts to normal behaviour.

To post a comment you must log in.
Revision history for this message
Chris Jones (cmsj) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/config.py'
2--- terminatorlib/config.py 2012-04-19 10:06:26 +0000
3+++ terminatorlib/config.py 2012-06-26 18:45:35 +0000
4@@ -161,7 +161,8 @@
5 'new_terminator' : '<Super>i',
6 'broadcast_off' : '',
7 'broadcast_group' : '',
8- 'broadcast_all' : ''
9+ 'broadcast_all' : '',
10+ 'edit_window_title': ''
11 },
12 'profiles': {
13 'default': {
14
15=== modified file 'terminatorlib/prefseditor.py'
16--- terminatorlib/prefseditor.py 2012-04-19 09:59:33 +0000
17+++ terminatorlib/prefseditor.py 2012-06-26 18:45:35 +0000
18@@ -126,7 +126,8 @@
19 'new_terminator' : 'Spawn a new Terminator process',
20 'broadcast_off' : 'Don\'t broadcast key presses',
21 'broadcast_group' : 'Broadcast key presses to group',
22- 'broadcast_all' : 'Broadcast key events to all'
23+ 'broadcast_all' : 'Broadcast key events to all',
24+ 'edit_window_title': 'Edit window title'
25 }
26
27 def __init__ (self, term):
28
29=== modified file 'terminatorlib/terminal.py'
30--- terminatorlib/terminal.py 2012-04-19 10:03:51 +0000
31+++ terminatorlib/terminal.py 2012-06-26 18:45:35 +0000
32@@ -1634,6 +1634,37 @@
33 def key_broadcast_all(self):
34 self.set_groupsend(None, self.terminator.groupsend_type['all'])
35
36+ def key_edit_window_title(self):
37+ window = self.get_toplevel()
38+ dialog = gtk.Dialog(_('Rename Window'), window,
39+ gtk.DIALOG_MODAL,
40+ ( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
41+ gtk.STOCK_OK, gtk.RESPONSE_ACCEPT ))
42+ dialog.set_default_response(gtk.RESPONSE_ACCEPT)
43+ dialog.set_has_separator(False)
44+ dialog.set_resizable(False)
45+ dialog.set_border_width(8)
46+
47+ label = gtk.Label(_('Enter a new title for the Terminator window...'))
48+ name = gtk.Entry()
49+ name.set_activates_default(True)
50+ if window.title.text != self.vte.get_window_title():
51+ name.set_text(self.get_toplevel().title.text)
52+
53+ dialog.vbox.pack_start(label, False, False, 6)
54+ dialog.vbox.pack_start(name, False, False, 6)
55+
56+ dialog.show_all()
57+ res = dialog.run()
58+ if res == gtk.RESPONSE_ACCEPT:
59+ if name.get_text():
60+ window.title.force_title(None)
61+ window.title.force_title(name.get_text())
62+ else:
63+ window.title.force_title(None)
64+ dialog.destroy()
65+ return
66+
67 # End key events
68
69 gobject.type_register(Terminal)