diff --git a/outlay-gtk/data/icons/hicolor/scalable/apps/io.github.outlay.svg b/outlay-gtk/data/icons/hicolor/scalable/apps/io.github.outlay.svg
new file mode 100644
index 0000000..17953ba
--- /dev/null
+++ b/outlay-gtk/data/icons/hicolor/scalable/apps/io.github.outlay.svg
@@ -0,0 +1,21 @@
+
+
diff --git a/outlay-gtk/data/io.github.outlay.desktop b/outlay-gtk/data/io.github.outlay.desktop
new file mode 100644
index 0000000..d3332d1
--- /dev/null
+++ b/outlay-gtk/data/io.github.outlay.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Outlay
+Comment=Personal income and expense logger
+Exec=outlay-gtk
+Icon=io.github.outlay
+Terminal=false
+Type=Application
+Categories=Office;Finance;
+Keywords=expense;budget;money;finance;income;
diff --git a/outlay-gtk/data/io.github.outlay.gschema.xml b/outlay-gtk/data/io.github.outlay.gschema.xml
new file mode 100644
index 0000000..3de6dd9
--- /dev/null
+++ b/outlay-gtk/data/io.github.outlay.gschema.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ 900
+
+
+ 600
+
+
+ false
+
+
+
diff --git a/outlay-gtk/src/window.rs b/outlay-gtk/src/window.rs
index 47c2b68..c7033f9 100644
--- a/outlay-gtk/src/window.rs
+++ b/outlay-gtk/src/window.rs
@@ -1,4 +1,5 @@
use adw::prelude::*;
+use gtk::glib;
use outlay_core::db::Database;
use std::rc::Rc;
@@ -120,14 +121,52 @@ impl MainWindow {
split_view.set_sidebar(Some(&sidebar_page));
split_view.set_content(Some(&content_page));
+ // Restore window size from settings
+ let saved_width: i32 = db
+ .get_setting("window_width")
+ .ok()
+ .flatten()
+ .and_then(|s| s.parse().ok())
+ .unwrap_or(900);
+ let saved_height: i32 = db
+ .get_setting("window_height")
+ .ok()
+ .flatten()
+ .and_then(|s| s.parse().ok())
+ .unwrap_or(600);
+ let saved_maximized: bool = db
+ .get_setting("window_maximized")
+ .ok()
+ .flatten()
+ .map(|s| s == "true")
+ .unwrap_or(false);
+
let window = adw::ApplicationWindow::builder()
.application(app)
.title("Outlay")
- .default_width(900)
- .default_height(600)
+ .default_width(saved_width)
+ .default_height(saved_height)
.content(&split_view)
.build();
+ if saved_maximized {
+ window.maximize();
+ }
+
+ // Save window size on close
+ {
+ let db_ref = db.clone();
+ window.connect_close_request(move |win| {
+ let (width, height) = win.default_size();
+ db_ref.set_setting("window_width", &width.to_string()).ok();
+ db_ref.set_setting("window_height", &height.to_string()).ok();
+ db_ref
+ .set_setting("window_maximized", if win.is_maximized() { "true" } else { "false" })
+ .ok();
+ glib::Propagation::Proceed
+ });
+ }
+
MainWindow {
window,
split_view,