diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 422993c9..ff891b34 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -330,7 +330,7 @@ class Config(object): def add_layout(self, name, layout): """Add a new layout""" return(self.base.add_layout(name, layout)) - + def replace_layout(self, name, layout): """Replace an existing layout""" return(self.base.replace_layout(name, layout)) diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index b1c3994e..c655ba11 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -329,7 +329,12 @@ class PrefsEditor: self.layoutiters[layout] = liststore.append([layout, editable]) selection = widget.get_selection() selection.connect('changed', self.on_layout_selection_changed) - selection.select_iter(self.layoutiters['default']) + terminator = Terminator() + if terminator.layoutname: + layout_to_highlight = terminator.layoutname + else: + layout_to_highlight = 'default' + selection.select_iter(self.layoutiters[layout_to_highlight]) # Now set up the selection changed handler for the layout itself widget = guiget('LayoutTreeView') selection = widget.get_selection() @@ -1093,9 +1098,10 @@ class PrefsEditor: selected = treeview.get_selection() (model, rowiter) = selected.get_selected() name = model.get_value(rowiter, 0) - + if self.config.replace_layout(name, current_layout): treeview.set_cursor(model.get_path(rowiter), column=treeview.get_column(0), start_editing=False) + self.config.save() def on_layoutremovebutton_clicked(self, _button): """Remove a layout from the list""" diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index eeb3859f..d3426a28 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -49,6 +49,7 @@ class Terminator(Borg): debug_address = None doing_layout = None + layoutname = None last_active_window = None groupsend = None @@ -302,6 +303,8 @@ class Terminator(Borg): window.set_fullscreen(window.isfullscreen) window.create_layout(layout[windef]) + self.layoutname = layoutname + def layout_done(self): """Layout operations have finished, record that fact""" self.doing_layout = False