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:
parent
300e2cc2b6
commit
a893d7a6f0
@ -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.
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user