From 5c06699a80503ca83687c376c03f91b3b463bdbc Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Fri, 13 Aug 2021 20:39:00 +0200 Subject: [PATCH] feat(core): add search bar context menu entry --- espanso/src/engine/process/middleware/context_menu.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/espanso/src/engine/process/middleware/context_menu.rs b/espanso/src/engine/process/middleware/context_menu.rs index 654b4e3..f4109ce 100644 --- a/espanso/src/engine/process/middleware/context_menu.rs +++ b/espanso/src/engine/process/middleware/context_menu.rs @@ -31,6 +31,7 @@ const CONTEXT_ITEM_ENABLE: u32 = 2; const CONTEXT_ITEM_DISABLE: u32 = 3; const CONTEXT_ITEM_SECURE_INPUT_EXPLAIN: u32 = 4; const CONTEXT_ITEM_SECURE_INPUT_TRIGGER_WORKAROUND: u32 = 5; +const CONTEXT_ITEM_OPEN_SEARCH: u32 = 6; pub struct ContextMenuMiddleware { is_enabled: RefCell, @@ -71,6 +72,10 @@ impl Middleware for ContextMenuMiddleware { label: "Enable".to_string(), } }), + MenuItem::Simple(SimpleMenuItem { + id: CONTEXT_ITEM_OPEN_SEARCH, + label: "Open search bar".to_string(), + }), MenuItem::Separator, MenuItem::Simple(SimpleMenuItem { id: CONTEXT_ITEM_RELOAD, @@ -133,6 +138,10 @@ impl Middleware for ContextMenuMiddleware { dispatch(Event::caused_by(event.source_id, EventType::LaunchSecureInputAutoFix)); Event::caused_by(event.source_id, EventType::NOOP) } + CONTEXT_ITEM_OPEN_SEARCH => { + dispatch(Event::caused_by(event.source_id, EventType::ShowSearchBar)); + Event::caused_by(event.source_id, EventType::NOOP) + } custom => { // TODO: handle dynamic items todo!()