From 4944ccabe711ba425e2f3d89c941499b7b21d332 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Fri, 20 Mar 2009 00:23:37 +0000 Subject: [PATCH] make tab bar more configurable. Closes LP: #287307 --- doc/terminator_config.5 | 4 ++++ terminatorlib/config.py | 1 + terminatorlib/terminator.py | 13 +++++++------ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 95f756aa..b543e215 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -201,6 +201,10 @@ Default value: \fBFalse\fR If set to True, the tab bar will be hidden. This means there will be no visual indication of either how many tabs there are, or which one you are on. Be warned that this can be very confusing and hard to use. Default value: \fBFalse\fR .TP +.B scroll_tabbar \fR(boolean) +If set to True, the tab bar will not fill the width of the window. The titlebars of the tabs will only take as much space as is necessary for the text they contain. Except, that is, if the tabs no longer fit the width of the window - in that case scroll buttons will appear to move through the tabs. +Default value: \fBFalse\fR +.TP .B copy_on_selection \fR(boolean) If set to True, text selections will be automatically copied to the clipboard, in addition to being made the Primary selection. Default value: \fBFalse\fR diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 68589b77..d0d12e2d 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -108,6 +108,7 @@ Defaults = { 'enable_real_transparency' : False, 'try_posix_regexp' : platform.system() != 'Linux', 'hide_tabbar' : False, + 'scroll_tabbar' : False, 'keybindings' : { 'zoom_in' : 'plus', 'zoom_out' : 'minus', diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 016dc4aa..0f5dd5af 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -539,7 +539,7 @@ class Terminator: parent.insert_page(pane, None, page) notebooktablabel = TerminatorNotebookTabLabel(widget.get_window_title(), parent, self) parent.set_tab_label(pane,notebooktablabel) - parent.set_tab_label_packing(pane, True, True, gtk.PACK_START) + parent.set_tab_label_packing(pane, not self.conf.scroll_tabbar, not self.conf.scroll_tabbar, gtk.PACK_START) if self._tab_reorderable: parent.set_tab_reorderable(pane, True) parent.set_current_page(page) @@ -682,7 +682,8 @@ class Terminator: if self._tab_reorderable: notebook.connect('page-reordered',self.on_page_reordered) notebook.set_tab_reorderable(widget, True) - notebook.set_property('homogeneous', True) + notebook.set_property('homogeneous', not self.conf.scroll_tabbar) + notebook.set_scrollable (self.conf.scroll_tabbar) # Config validates this. pos = getattr(gtk, "POS_%s" % self.conf.tab_position.upper()) notebook.set_tab_pos(pos) @@ -707,7 +708,7 @@ class Terminator: notebooklabel = widget.get_window_title() notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self) notebook.set_tab_label(child, notebooktablabel) - notebook.set_tab_label_packing(child, True, True, gtk.PACK_START) + notebook.set_tab_label_packing(child, not self.conf.scroll_tabbar, not self.conf.scroll_tabbar, gtk.PACK_START) wal = self.window.allocation if not (self._maximised or self._fullscreen): @@ -732,7 +733,7 @@ class Terminator: notebooklabel = terminal.get_window_title() notebooktablabel = TerminatorNotebookTabLabel(notebooklabel, notebook, self) notebook.set_tab_label(terminal, notebooktablabel) - notebook.set_tab_label_packing(terminal, True, True, gtk.PACK_START) + notebook.set_tab_label_packing(terminal, not self.conf.scroll_tabbar, not self.conf.scroll_tabbar, gtk.PACK_START) if self._tab_reorderable: notebook.set_tab_reorderable(terminal,True) ## Now, we set focus on the new term @@ -807,7 +808,7 @@ class Terminator: grandparent.remove_page(page) grandparent.insert_page(sibling, None,page) grandparent.set_tab_label(sibling, TerminatorNotebookTabLabel("",grandparent, self)) - grandparent.set_tab_label_packing(sibling, True, True, gtk.PACK_START) + grandparent.set_tab_label_packing(sibling, not self.conf.scroll_tabbar, not self.conf.scroll_tabbar, gtk.PACK_START) if self._tab_reorderable: grandparent.set_tab_reorderable(sibling, True) grandparent.set_current_page(page) @@ -1375,7 +1376,7 @@ class Terminator: if isinstance(self.old_parent, gtk.Notebook): self.old_parent.insert_page(widget, None, self.old_page) self.old_parent.set_tab_label(widget, TerminatorNotebookTabLabel("", self.old_parent, self)) - self.old_parent.set_tab_label_packing(widget, True, True, gtk.PACK_START) + self.old_parent.set_tab_label_packing(widget, not self.conf.scroll_tabbar, not self.conf.scroll_tabbar, gtk.PACK_START) if self._tab_reorderable: self.old_parent.set_tab_reorderable(widget, True) self.old_parent.set_current_page(self.old_page)