From dcb1da071744b60d8c5f4c670a360889130e92cb Mon Sep 17 00:00:00 2001 From: ARAKHNID Date: Tue, 30 Apr 2024 18:32:27 -0500 Subject: [PATCH] Window: remember size GSettings now stores two schemas that'll remember the window width and height. Closes #634 --- data/com.github.maoschanz.drawing.gschema.xml | 14 ++++++++++++-- src/window.py | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/data/com.github.maoschanz.drawing.gschema.xml b/data/com.github.maoschanz.drawing.gschema.xml index e88e451b..2173e254 100644 --- a/data/com.github.maoschanz.drawing.gschema.xml +++ b/data/com.github.maoschanz.drawing.gschema.xml @@ -89,10 +89,20 @@ + + 1000 + Width of the window + The width of the last closed window. + + + 600 + Height of the window + The height of the last closed window. + false - State of the window - The state of the last closed window. + Maximization of the window + The maximization state of the last closed window. false diff --git a/src/window.py b/src/window.py index 9ddf8da3..c610fc35 100644 --- a/src/window.py +++ b/src/window.py @@ -72,6 +72,7 @@ def __init__(self, **kwargs): self.devel_mode = False self.should_track_framerate = False + self.resize(self.gsettings.get_int("window-width"), self.gsettings.get_int("window-height")) if self.gsettings.get_boolean('maximized'): self.maximize() @@ -384,6 +385,8 @@ def on_close(self, *args): self._decorations.remove_from_ui() self.options_manager.persist_tools_options() self.gsettings.set_string('last-active-tool', self.active_tool_id) + self.gsettings.set_int("window-width", self.get_size().width) + self.gsettings.set_int("window-height", self.get_size().height) self.gsettings.set_boolean('maximized', self.is_maximized()) return False