Active Window saved to layouts, and made active when loaded

This commit is contained in:
Stephen Boddy 2013-10-31 18:50:21 +01:00
parent ef57c5a5f6
commit d265dd5724
3 changed files with 15 additions and 0 deletions

View File

@ -282,6 +282,12 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
if len(labels) > 0: if len(labels) > 0:
layout['labels'] = labels 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 name = 'child%d' % count
count = count + 1 count = count + 1

View File

@ -34,6 +34,7 @@ class Terminator(Borg):
debug_address = None debug_address = None
doing_layout = None doing_layout = None
last_active_window = None
groupsend = None groupsend = None
groupsend_type = {'all':0, 'group':1, 'off':2} groupsend_type = {'all':0, 'group':1, 'off':2}
@ -292,6 +293,10 @@ class Terminator(Borg):
"""Layout operations have finished, record that fact""" """Layout operations have finished, record that fact"""
self.doing_layout = False self.doing_layout = False
for window in self.windows:
if window.uuid == self.last_active_window:
window.show()
for terminal in self.terminals: for terminal in self.terminals:
if not terminal.pid: if not terminal.pid:
terminal.spawn_child() terminal.spawn_child()

View File

@ -239,6 +239,7 @@ class Window(Container, gtk.Window):
def on_focus_in(self, window, event): def on_focus_in(self, window, event):
"""Focus has entered the window""" """Focus has entered the window"""
self.set_urgency_hint(False) self.set_urgency_hint(False)
self.terminator.last_active_window = self.uuid
# FIXME: Cause the terminal titlebars to update here # FIXME: Cause the terminal titlebars to update here
def is_child_notebook(self): def is_child_notebook(self):
@ -865,6 +866,9 @@ class Window(Container, gtk.Window):
self.get_children()[0].create_layout(child) 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 WindowTitle(object):
"""Class to handle the setting of the window title""" """Class to handle the setting of the window title"""