diff --git a/terminatorlib/container.py b/terminatorlib/container.py index cecd8588..aabd454a 100755 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -282,6 +282,12 @@ the %s will also close all terminals within it.') % (reqtype, reqtype)) if len(labels) > 0: layout['labels'] = labels + if mytype == 'Window': + if self.uuid == self.terminator.last_active_window: + layout['last_active_window'] = True + else: + layout['last_active_window'] = False + name = 'child%d' % count count = count + 1 diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index f66e0602..add1ad68 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -34,6 +34,7 @@ class Terminator(Borg): debug_address = None doing_layout = None + last_active_window = None groupsend = None groupsend_type = {'all':0, 'group':1, 'off':2} @@ -292,6 +293,10 @@ class Terminator(Borg): """Layout operations have finished, record that fact""" self.doing_layout = False + for window in self.windows: + if window.uuid == self.last_active_window: + window.show() + for terminal in self.terminals: if not terminal.pid: terminal.spawn_child() diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 0f5ab34f..14829191 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -239,6 +239,7 @@ class Window(Container, gtk.Window): def on_focus_in(self, window, event): """Focus has entered the window""" self.set_urgency_hint(False) + self.terminator.last_active_window = self.uuid # FIXME: Cause the terminal titlebars to update here def is_child_notebook(self): @@ -865,6 +866,9 @@ class Window(Container, gtk.Window): self.get_children()[0].create_layout(child) + if layout.has_key('last_active_window') and layout['last_active_window'] == 'True': + self.terminator.last_active_window = self.uuid + class WindowTitle(object): """Class to handle the setting of the window title"""