1
0
mirror of https://github.com/pcvolkmer/checkbar.git synced 2025-04-19 19:16:50 +00:00

Ignore click event if not left mouse button

This commit is contained in:
Paul-Christian Volkmer 2022-03-07 12:23:19 +01:00
parent 300e2cc2b6
commit a893d7a6f0
2 changed files with 5 additions and 2 deletions

View File

@ -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.

View File

@ -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::<ClickEvent>(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;
}