Ticket #164: vte-titles.patch

File vte-titles.patch, 2.6 KB (added by ulidtko, 21 months ago)

Patch which implements tab naming based on terminal title

  • data/guake.schemas

    diff --git a/data/guake.schemas b/data/guake.schemas
    index 3d26c6d..403bf1d 100644
    a b  
    208208            </locale> 
    209209        </schema> 
    210210 
     211        <schema> 
     212            <key>/schemas/apps/guake/general/use_vte_titles</key> 
     213            <applyto>/apps/guake/general/use_vte_titles</applyto> 
     214            <owner>guake</owner> 
     215            <type>bool</type> 
     216            <default>true</default> 
     217            <locale name="C"> 
     218                <short>Use terminal titles for tab naming</short> 
     219                <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> 
     220            </locale> 
     221        </schema> 
     222 
    211223        <schema> 
    212224            <key>/schemas/apps/guake/style/font/style</key> 
    213225            <applyto>/apps/guake/style/font/style</applyto> 
  • src/guake.py

    diff --git a/src/guake.py b/src/guake.py
    index 6214fb2..81c8057 100644
    a b  
    863863        self.client.notify(KEY('/general/use_scrollbar')) 
    864864        self.client.notify(KEY('/general/history_size')) 
    865865        self.client.notify(KEY('/general/show_resizer')) 
     866        self.client.notify(KEY('/general/use_vte_titles')) 
    866867        self.client.notify(KEY('/style/font/style')) 
    867868        self.client.notify(KEY('/style/font/color')) 
    868869        self.client.notify(KEY('/style/font/palette')) 
     
    982983        """ 
    983984        self.delete_tab(self.notebook.page_num(widget), kill=False) 
    984985 
     986    def on_terminal_title_changed(self, vte, box): 
     987        use_them = self.client.get_bool(KEY("/general/use_vte_titles")) 
     988        if not use_them: 
     989            return 
     990        page = self.notebook.page_num(box) 
     991        self.tabs.get_children()[page].set_label(vte.get_window_title()) 
     992 
    985993    def on_rename_activate(self, *args): 
    986994        """Shows a dialog to rename the current tab. 
    987995        """ 
     
    11221130        box.terminal.grab_focus() 
    11231131        box.terminal.connect('button-press-event', self.show_context_menu) 
    11241132        box.terminal.connect('child-exited', self.on_terminal_exited, box) 
     1133        box.terminal.connect('window-title-changed', 
     1134                             self.on_terminal_title_changed, box) 
    11251135        box.show() 
    11261136 
    11271137        self.term_list.append(box.terminal)