summaryrefslogtreecommitdiff
blob: 2559e21feb7bf05dac25c73f382ea3898fec41f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from http://guake.org/ticket/164

diff --git a/data/guake.schemas b/data/guake.schemas
index 3d26c6d..403bf1d 100644
--- a/data/guake.schemas
+++ b/data/guake.schemas
@@ -208,6 +208,18 @@
             </locale>
         </schema>
 
+	<schema>
+            <key>/schemas/apps/guake/general/use_vte_titles</key>
+            <applyto>/apps/guake/general/use_vte_titles</applyto>
+            <owner>guake</owner>
+            <type>bool</type>
+            <default>true</default>
+            <locale name="C">
+                <short>Use terminal titles for tab naming</short>
+                <long>Any terminal program can set the terminal's title via special escape sequences. Some shells (e.g. bash) display user's prompt there (though you can adjust that to any arbitrary text in bashrc or similar) and update it automatically as the prompt changes. So you can have easy automatically updating meaningful tab titles with this option turned on.</long>
+            </locale>
+        </schema>
+
         <schema>
             <key>/schemas/apps/guake/style/font/style</key>
             <applyto>/apps/guake/style/font/style</applyto>
diff --git a/src/guake.py b/src/guake.py
index 6214fb2..81c8057 100644
--- a/src/guake.py
+++ b/src/guake.py
@@ -863,6 +863,7 @@ class Guake(SimpleGladeApp):
         self.client.notify(KEY('/general/use_scrollbar'))
         self.client.notify(KEY('/general/history_size'))
         self.client.notify(KEY('/general/show_resizer'))
+        self.client.notify(KEY('/general/use_vte_titles'))
         self.client.notify(KEY('/style/font/style'))
         self.client.notify(KEY('/style/font/color'))
         self.client.notify(KEY('/style/font/palette'))
@@ -982,6 +983,13 @@ class Guake(SimpleGladeApp):
         """
         self.delete_tab(self.notebook.page_num(widget), kill=False)
 
+    def on_terminal_title_changed(self, vte, box):
+        use_them = self.client.get_bool(KEY("/general/use_vte_titles"))
+        if not use_them:
+            return
+        page = self.notebook.page_num(box)
+        self.tabs.get_children()[page].set_label(vte.get_window_title())
+
     def on_rename_activate(self, *args):
         """Shows a dialog to rename the current tab.
         """
@@ -1122,6 +1130,8 @@ class Guake(SimpleGladeApp):
         box.terminal.grab_focus()
         box.terminal.connect('button-press-event', self.show_context_menu)
         box.terminal.connect('child-exited', self.on_terminal_exited, box)
+        box.terminal.connect('window-title-changed',
+                             self.on_terminal_title_changed, box)
         box.show()
 
         self.term_list.append(box.terminal)