From 70d97bf90d7ad531f8f7f77099b2cfa99e8431b6 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sun, 31 Oct 2021 16:30:52 +0100 Subject: [PATCH] feat(engine): implement toggle event --- espanso-engine/src/event/mod.rs | 1 + espanso-engine/src/process/middleware/disable.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/espanso-engine/src/event/mod.rs b/espanso-engine/src/event/mod.rs index 43397e7..841310e 100644 --- a/espanso-engine/src/event/mod.rs +++ b/espanso-engine/src/event/mod.rs @@ -82,6 +82,7 @@ pub enum EventType { Enabled, DisableRequest, EnableRequest, + ToggleRequest, SecureInputEnabled(internal::SecureInputEnabledEvent), SecureInputDisabled, diff --git a/espanso-engine/src/process/middleware/disable.rs b/espanso-engine/src/process/middleware/disable.rs index 5b7e633..41438cf 100644 --- a/espanso-engine/src/process/middleware/disable.rs +++ b/espanso-engine/src/process/middleware/disable.rs @@ -93,6 +93,10 @@ impl Middleware for DisableMiddleware { *enabled = false; has_status_changed = true; } + EventType::ToggleRequest => { + *enabled = !*enabled; + has_status_changed = true; + } _ => {} }