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

Window: remember size #639

Merged
merged 1 commit into from
May 25, 2024
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
14 changes: 12 additions & 2 deletions data/com.github.maoschanz.drawing.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,20 @@
</key>

<!-- Remembered state of the window -->
<key type="i" name="window-width">
<default>1000</default>
<summary>Width of the window</summary>
<description>The width of the last closed window.</description>
</key>
<key type="i" name="window-height">
<default>600</default>
<summary>Height of the window</summary>
<description>The height of the last closed window.</description>
</key>
<key type="b" name="maximized">
<default>false</default>
<summary>State of the window</summary>
<description>The state of the last closed window.</description>
<summary>Maximization of the window</summary>
<description>The maximization state of the last closed window.</description>
</key>
<key type="b" name="show-labels">
<default>false</default>
Expand Down
3 changes: 3 additions & 0 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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

Expand Down