From 4734eabb0d1e3dd4fa6b1f20926d94b8560a5fd1 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 26 Jun 2021 22:40:38 +0200 Subject: [PATCH] fix(core): fix wrong handler override on macOS bundle --- espanso/src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/espanso/src/main.rs b/espanso/src/main.rs index 686ab09..4269b7e 100644 --- a/espanso/src/main.rs +++ b/espanso/src/main.rs @@ -325,12 +325,12 @@ fn main() { .find(|cli| matches.subcommand_matches(&cli.subcommand).is_some()); // When started from the macOS App Bundle, override the default - // handler with "launcher", otherwise the GUI could not be started. - if let Some(context) = std::env::var_os("MAC_LAUNCH_CONTEXT") { - if context == "bundle" { - handler = CLI_HANDLERS - .iter() - .find(|cli| cli.subcommand == "launcher"); + // handler with "launcher" if not present, otherwise the GUI could not be started. + if handler.is_none() { + if let Some(context) = std::env::var_os("MAC_LAUNCH_CONTEXT") { + if context == "bundle" { + handler = CLI_HANDLERS.iter().find(|cli| cli.subcommand == "launcher"); + } } }