fix: Added fix for nix build
This commit is contained in:
26
src/lib.rs
26
src/lib.rs
@@ -211,26 +211,24 @@ pub async fn execute_dpms_command(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the command for hyprland dispatch
|
// Execute the command via hyprland dispatch
|
||||||
let dispatch_type = match action {
|
match (action, monitor) {
|
||||||
"on" => {
|
("on", Some(monitor_name)) => {
|
||||||
if let Some(monitor_name) = monitor {
|
let command_str = format!("on {}", monitor_name);
|
||||||
DispatchType::Custom("dpms", &format!("on {}", monitor_name))
|
Dispatch::call(DispatchType::Custom("dpms", &command_str))?;
|
||||||
} else {
|
|
||||||
DispatchType::Custom("dpms", "on")
|
|
||||||
}
|
}
|
||||||
|
("on", None) => {
|
||||||
|
Dispatch::call(DispatchType::Custom("dpms", "on"))?;
|
||||||
}
|
}
|
||||||
"off" => {
|
("off", Some(monitor_name)) => {
|
||||||
if let Some(monitor_name) = monitor {
|
let command_str = format!("off {}", monitor_name);
|
||||||
DispatchType::Custom("dpms", &format!("off {}", monitor_name))
|
Dispatch::call(DispatchType::Custom("dpms", &command_str))?;
|
||||||
} else {
|
|
||||||
DispatchType::Custom("dpms", "off")
|
|
||||||
}
|
}
|
||||||
|
("off", None) => {
|
||||||
|
Dispatch::call(DispatchType::Custom("dpms", "off"))?;
|
||||||
}
|
}
|
||||||
_ => return Err("Invalid action".into()),
|
_ => return Err("Invalid action".into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
Dispatch::call(dispatch_type)?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user