diff --git a/src/app/preferences.rs b/src/app/preferences.rs index 0e0bf64..cc79760 100644 --- a/src/app/preferences.rs +++ b/src/app/preferences.rs @@ -10,6 +10,7 @@ pub static PREFERENCES: Mutex = Mutex::new(Preferences::new()); #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Preferences { + pub open_in_fullscreen: bool, pub min_svg_size: u32, pub zoom_speed: f32, pub jpeg_quality: u8, @@ -20,6 +21,7 @@ pub struct Preferences { impl Preferences { const fn new() -> Self { Self { + open_in_fullscreen: false, min_svg_size: 1000, zoom_speed: 1.0, jpeg_quality: 80, @@ -55,6 +57,12 @@ impl App { .open(&mut open) .show(ctx, |ui| { egui::Grid::new("preferences grid").show(ui, |ui| { + ui.with_layout(egui::Layout::right_to_left(egui::Align::RIGHT), |ui| { + ui.label("Open in fullscreen: "); + }); + ui.add(egui::Checkbox::new(&mut preferences.open_in_fullscreen, "")); + ui.end_row(); + ui.with_layout(egui::Layout::right_to_left(egui::Align::RIGHT), |ui| { ui.label("Zoom Speed: "); }); diff --git a/src/main.rs b/src/main.rs index 2b661ac..1e083f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,12 +67,14 @@ impl<'a> WindowHandler<'a> { let event_loop: EventLoop = EventLoopBuilder::with_user_event().build().unwrap(); let proxy = event_loop.create_proxy(); - let fullscreen = if fullscreen { + let fullscreen = if fullscreen || config.preferences.open_in_fullscreen { Some(Fullscreen::Borderless(None)) } else { None }; + *PREFERENCES.lock().unwrap() = config.preferences; + let builder = WindowBuilder::new() .with_title(String::from("Simp")) .with_visible(false)