From a893d7a6f078661359897b358de5678ce1263e3d Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 7 Mar 2022 12:23:19 +0100 Subject: [PATCH] Ignore click event if not left mouse button --- README.adoc | 2 -- src/main.rs | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index c4154ac..9755379 100644 --- a/README.adoc +++ b/README.adoc @@ -50,8 +50,6 @@ The color configuration is optional. If used, all colors must be specified. === Execute commands -_This feature is still experimental._ - You can also specify a command to be executed when a mouse click occurs on a checked host. Use `click_cmd` to specifiy the command to be executed, e.g. diff --git a/src/main.rs b/src/main.rs index d22c24b..acee653 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,6 +41,7 @@ struct ActuatorResponse { #[derive(Deserialize)] struct ClickEvent { name: String, + button: u8, } struct CheckResult { @@ -184,6 +185,10 @@ async fn main() { let input = input.replace(",{", "{"); if let Ok(click_event) = serde_json::from_str::(input.as_str()) { + // Ignore click event if not left mouse button + if click_event.button != 1 { + continue; + }; if let Some(click_cmd) = get_click_cmd(click_event.name).await { run_click_cmd(click_cmd).await; }