From 4a292a583441a3047dde5d10d2d40bab24622e3b Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 9 Aug 2026 21:49:33 -0700 Subject: [PATCH 1/2] fix: initial images not loading on opening new path --- src/app/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index 8ef9843..63ac6b0 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -44,6 +44,8 @@ struct State { columns: usize, + key: usize, + error: Option, } @@ -51,9 +53,10 @@ impl State { fn new() -> (Self, Task) { ( Self { - columns: 3, - error: None, images: BTreeMap::new(), + columns: 3, + key: 0, + error: None, }, Task::done(Message::OpenPath(Some( env::args() @@ -107,7 +110,7 @@ impl State { .arg(path) .spawn() .map_err(|e| e.to_string()) - .err() + .err(); } Message::OpenPath(opt_path) => { @@ -117,6 +120,7 @@ impl State { }; if let Some(path) = opt_path { + self.key += 1; self.open_path(path); } } @@ -164,6 +168,7 @@ impl State { || Element::from(widget::space()), |handle| widget::image(handle).into(), )) + .key(self.key) .anticipate(2000) .on_show(|_size| Message::LoadImage(path.clone())) .on_hide(Message::UnloadImage(path.clone())), From 5f85338c72f6594ebb84acfe22b70b16de88b9e7 Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 9 Aug 2026 22:12:49 -0700 Subject: [PATCH 2/2] feat: rudimentary keyboard scrolling I want smooth scrolling :( --- src/app/mod.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/app/mod.rs b/src/app/mod.rs index 63ac6b0..ca810f3 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -142,6 +142,31 @@ impl State { ); } + keyboard::Key::Character("j") + | keyboard::Key::Named( + keyboard::key::Named::ArrowDown | keyboard::key::Named::PageDown, + ) => { + return widget::operation::scroll_by( + "main", + widget::operation::AbsoluteOffset { + x: 0., + y: if modifiers.shift() { 100. } else { 30. }, + }, + ); + } + keyboard::Key::Character("k") + | keyboard::Key::Named( + keyboard::key::Named::ArrowUp | keyboard::key::Named::PageUp, + ) => { + return widget::operation::scroll_by( + "main", + widget::operation::AbsoluteOffset { + x: 0., + y: if modifiers.shift() { -100. } else { -30. }, + }, + ); + } + keyboard::Key::Character("=" | "+") => { self.columns = (self.columns + 1).clamp(1, 10) } @@ -190,6 +215,7 @@ impl State { })) .columns(self.columns), ) + .id("main") .height(Length::Fill) .into(), self.error.as_ref().map_or_else(