From 1673f54609c86503756eb1d6b9483692852a8322 Mon Sep 17 00:00:00 2001 From: Javier Feliz Date: Thu, 4 Sep 2025 20:52:39 -0400 Subject: [PATCH] Had claude fix an issue --- src/main.rs | 2 +- src/plugins/file_search.rs | 3 ++- src/ui/controller.rs | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index a1bbcbd..282a462 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ fn main() { let ui = GtkLauncherUI::new(app); // Create and run the controller - let controller = LauncherController::new(launcher, ui); + let controller = LauncherController::new(launcher, ui, app.clone()); controller.run(); }); diff --git a/src/plugins/file_search.rs b/src/plugins/file_search.rs index fd36cba..fd27c38 100644 --- a/src/plugins/file_search.rs +++ b/src/plugins/file_search.rs @@ -30,9 +30,10 @@ impl LauncherListItem for FileEntry { fn execute(&self) -> Result<(), LaunchError> { let file_uri = gio::File::for_path(&self.path); + let ctx = gio::AppLaunchContext::new(); match gio::AppInfo::launch_default_for_uri( file_uri.uri().as_str(), - None::<&gio::AppLaunchContext>, + Some(&ctx), ) { Err(_) => Err(LaunchError::CouldNotLaunch( "Error opening file".to_string(), diff --git a/src/ui/controller.rs b/src/ui/controller.rs index b068c88..dc031d6 100644 --- a/src/ui/controller.rs +++ b/src/ui/controller.rs @@ -1,6 +1,7 @@ use super::gtk::GtkLauncherUI; use super::traits::{LauncherUI, UIEvent}; use crate::{LaunchError, launcher::WaycastLauncher}; +use gio::prelude::ApplicationExt; use gtk::glib; use std::cell::RefCell; use std::rc::Rc; @@ -11,10 +12,11 @@ pub struct LauncherController { launcher: Rc>, ui: GtkLauncherUI, event_receiver: Receiver, + app: gtk::Application, } impl LauncherController { - pub fn new(launcher: WaycastLauncher, mut ui: GtkLauncherUI) -> Self { + pub fn new(launcher: WaycastLauncher, mut ui: GtkLauncherUI, app: gtk::Application) -> Self { let (event_sender, event_receiver) = mpsc::channel(); // Set up the event sender in the UI @@ -24,6 +26,7 @@ impl LauncherController { launcher: Rc::new(RefCell::new(launcher)), ui, event_receiver, + app, } } @@ -52,7 +55,8 @@ impl LauncherController { UIEvent::ItemActivated(index) => match self.launcher.borrow().execute_item(index) { Ok(_) => { - self.ui.hide(); + // Exit the application completely instead of just hiding + self.app.quit(); } Err(e) => { eprintln!("Failed to launch item: {:?}", e); @@ -66,7 +70,8 @@ impl LauncherController { } UIEvent::CloseRequested => { - self.ui.hide(); + // Exit the application completely instead of just hiding + self.app.quit(); } }