From f98e4c18205bc66e632c75898e275ec04e99b820 Mon Sep 17 00:00:00 2001 From: Jason Rodney Hansen Date: Fri, 11 Jul 2025 11:13:53 -0600 Subject: [PATCH] Open file on double-click in "Open With" --- src/app.rs | 58 +++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/src/app.rs b/src/app.rs index 8f74478..eafdfe3 100644 --- a/src/app.rs +++ b/src/app.rs @@ -4807,35 +4807,39 @@ impl Application for App { last_kind = *kind; } column = column.add( - widget::button::custom( - widget::row::with_children(vec![ - widget::icon(app.icon.clone()).size(32).into(), - if app.is_default && !displayed_default { - displayed_default = true; - widget::text::body(fl!( - "default-app", - name = Some(app.name.as_str()) - )) - .into() - } else { - widget::text::body(app.name.to_string()).into() - }, - widget::horizontal_space().into(), - if *selected == i { - widget::icon::from_name("checkbox-checked-symbolic") - .size(16) + widget::mouse_area( + widget::button::custom( + widget::row::with_children(vec![ + widget::icon(app.icon.clone()).size(32).into(), + if app.is_default && !displayed_default { + displayed_default = true; + widget::text::body(fl!( + "default-app", + name = Some(app.name.as_str()) + )) .into() - } else { - widget::Space::with_width(Length::Fixed(16.0)).into() - }, - ]) - .spacing(space_s) - .height(Length::Fixed(item_height)) - .align_y(Alignment::Center), + } else { + widget::text::body(app.name.to_string()).into() + }, + widget::horizontal_space().into(), + if *selected == i { + widget::icon::from_name("checkbox-checked-symbolic") + .size(16) + .into() + } else { + widget::Space::with_width(Length::Fixed(16.0)).into() + }, + ]) + .spacing(space_s) + .height(Length::Fixed(item_height)) + .align_y(Alignment::Center), + ) + .width(Length::Fill) + .class(theme::Button::MenuItem) + .force_enabled(true), ) - .width(Length::Fill) - .class(theme::Button::MenuItem) - .on_press(Message::OpenWithSelection(i)), + .on_press(Message::OpenWithSelection(i)) + .on_double_press(Message::DialogComplete), ); }