diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index d0b188d5..c4637051 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -115,6 +115,11 @@ Controls how much to reduce the colour values of fonts in terminals that do not factor. A font colour that was RGB(200,200,200) with an inactive_color_offset of 0.5 would set inactive terminals to RGB(100,100,100). .TP +.B always_split_with_profile +Controls whether splits/tabs will continue to use the profile of their peer terminal. If set to False, they will always use +the default profile. +Default value: \fBFalse\fR +.TP .B enabled_plugins A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 5844a8e4..ee47416a 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -105,6 +105,7 @@ DEFAULTS = { 'LaunchpadCodeURLHandler', 'APTURLHandler'], 'suppress_multiple_term_dialog': False, + 'always_split_with_profile': False, }, 'keybindings': { 'zoom_in' : 'plus', diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index f4b21af9..bfbdc445 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -136,6 +136,8 @@ class Notebook(Container, gtk.Notebook): sibling = maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if self.config['always_split_with_profile']: + sibling.force_set_profile(None, widget.get_profile()) self.insert_page(container, None, page_num) self.set_tab_reorderable(container, True) @@ -195,7 +197,7 @@ class Notebook(Container, gtk.Notebook): children.append(self.get_nth_page(page)) return(children) - def newtab(self, debugtab=False, widget=None, cwd=None, metadata=None): + def newtab(self, debugtab=False, widget=None, cwd=None, metadata=None, profile=None): """Add a new tab, optionally supplying a child widget""" dbg('making a new tab') maker = Factory() @@ -206,6 +208,8 @@ class Notebook(Container, gtk.Notebook): if cwd: widget.set_cwd(cwd) widget.spawn_child(debugserver=debugtab) + if profile and self.config['always_split_with_profile']: + widget.force_set_profile(None, profile) signals = {'close-term': self.wrapcloseterm, 'split-horiz': self.split_horiz, diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index 6d623498..eb1c8920 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -50,6 +50,8 @@ class Paned(Container): sibling = self.maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if self.config['always_split_with_profile']: + sibling.force_set_profile(None, widget.get_profile()) self.add(container) self.show_all() diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index a037824a..7b0bf05d 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -382,7 +382,7 @@ True False - 15 + 16 2 6 @@ -857,6 +857,36 @@ 15 + + + True + False + Re-use profiles for new terminals + + + 15 + 16 + + + + + True + True + False + False + 0 + True + + + + 1 + 2 + 15 + 16 + GTK_EXPAND + GTK_EXPAND + + True diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 6036c316..863b970d 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -238,6 +238,9 @@ class PrefsEditor: #Hide size text from the title bar widget = guiget('title_hide_sizetextcheck') widget.set_active(self.config['title_hide_sizetext']) + #Always split with profile + widget = guiget('always_split_with_profile') + widget.set_active(self.config['always_split_with_profile']) ## Profile tab # Populate the profile list @@ -610,6 +613,11 @@ class PrefsEditor: self.config['title_hide_sizetext'] = widget.get_active() self.config.save() + def on_always_split_with_profile_toggled(self, widget): + """Always split with profile setting changed""" + self.config['always_split_with_profile'] = widget.get_active() + self.config.save() + def on_allow_bold_checkbutton_toggled(self, widget): """Allow bold setting changed""" self.config['allow_bold'] = widget.get_active() diff --git a/terminatorlib/window.py b/terminatorlib/window.py index f96e4eb1..90a3cf5d 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -248,6 +248,7 @@ class Window(Container, gtk.Window): def tab_new(self, widget=None, debugtab=False, _param1=None, _param2=None): """Make a new tab""" cwd = None + profile = None if self.get_property('term_zoomed') == True: err("You can't create a tab while a terminal is maximised/zoomed") @@ -255,11 +256,13 @@ class Window(Container, gtk.Window): if widget: cwd = widget.get_cwd() + profile = widget.get_profile() + maker = Factory() if not self.is_child_notebook(): dbg('Making a new Notebook') notebook = maker.make('Notebook', window=self) - self.get_child().newtab(debugtab, cwd=cwd) + self.get_child().newtab(debugtab, cwd=cwd, profile=profile) def on_delete_event(self, window, event, data=None): """Handle a window close request""" @@ -456,6 +459,9 @@ class Window(Container, gtk.Window): sibling = maker.make('Terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if self.config['always_split_with_profile']: + sibling.force_set_profile(None, widget.get_profile()) + self.add(container) container.show_all()