Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save layout when splitting/closing split panes #2055

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions guake/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def restore_box_layout(self, box, panes: list):
Gtk.main_iteration()

if cur["type"].endswith("v"):
box = box.split_v()
box = box.split_v_no_save()
else:
box = box.split_h()
box = box.split_h_no_save()
self.restore_box_layout(box.get_child1(), panes)
self.restore_box_layout(box.get_child2(), panes)
else:
Expand Down Expand Up @@ -462,7 +462,17 @@ def split_h(self):
def split_v(self):
return self.split(DualTerminalBox.ORIENT_H)

def split_h_no_save(self):
return self.split_no_save(DualTerminalBox.ORIENT_V)

def split_v_no_save(self):
return self.split_no_save(DualTerminalBox.ORIENT_H)

@save_tabs_when_changed
def split(self, orientation):
self.split_no_save(orientation)

def split_no_save(self, orientation):
notebook = self.get_notebook()
parent = self.get_parent() # RootTerminalBox

Expand Down Expand Up @@ -613,6 +623,7 @@ def grab_box_terminal_focus(self, box):
else:
box.get_terminal().grab_focus()

@save_tabs_when_changed
def remove_dead_child(self, child):
if self.get_child1() is child:
living_child = self.get_child2()
Expand Down
6 changes: 3 additions & 3 deletions guake/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ def save_tabs_when_changed(func):
"""Decorator for save-tabs-when-changed"""

def wrapper(*args, **kwargs):
func(*args, **kwargs)
log.debug("mom, I've been called: %s %s", func.__name__, func)

# Find me the Guake!
clsname = args[0].__class__.__name__
g = None
Expand All @@ -87,6 +84,9 @@ def wrapper(*args, **kwargs):
elif getattr(args[0], "notebook", None):
g = args[0].notebook.guake

func(*args, **kwargs)
log.debug("mom, I've been called: %s %s", func.__name__, func)

# Tada!
if g and g.settings.general.get_boolean("save-tabs-when-changed"):
g.save_tabs()
Expand Down
6 changes: 6 additions & 0 deletions releasenotes/notes/save_subterminals-4d086becd64ffcfb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
release_summary: >
Guake now saves layout when splitting/closing split panes

fixes:
- |
- A closed subterminal returns back after restarting Guake #1686