feat(core): start espanso launcher when starting app-image directly

This commit is contained in:
Federico Terzi 2021-09-09 21:29:04 +02:00
parent 9628361db0
commit 36984a9426

View File

@ -441,14 +441,20 @@ fn main() {
.find(|cli| matches.subcommand_matches(&cli.subcommand).is_some()) .find(|cli| matches.subcommand_matches(&cli.subcommand).is_some())
}; };
// When started from the macOS App Bundle, override the default
// handler with "launcher" if not present, otherwise the GUI could not be started.
if handler.is_none() { if handler.is_none() {
// When started from the macOS App Bundle, override the default
// handler with "launcher" if not present, otherwise the GUI could not be started.
if let Some(context) = std::env::var_os("MAC_LAUNCH_CONTEXT") { if let Some(context) = std::env::var_os("MAC_LAUNCH_CONTEXT") {
if context == "bundle" { if context == "bundle" {
handler = CLI_HANDLERS.iter().find(|cli| cli.subcommand == "launcher"); handler = CLI_HANDLERS.iter().find(|cli| cli.subcommand == "launcher");
} }
} }
// When started from a Linux app image, override the default handler with the launcher
// to start espanso when double clicked
if std::env::var_os("APPIMAGE").is_some() {
handler = CLI_HANDLERS.iter().find(|cli| cli.subcommand == "launcher");
}
} }
if let Some(handler) = handler { if let Some(handler) = handler {