fix: Added fix for nix build
Some checks failed
build / checks-matrix (push) Has been cancelled
build / checks-build (push) Has been cancelled
build / codecov (push) Has been cancelled
docs / docs (push) Has been cancelled

This commit is contained in:
uttarayan21
2025-08-16 20:11:20 +05:30
parent ab566dc44d
commit 0e3079a6f8

View File

@@ -211,26 +211,24 @@ pub async fn execute_dpms_command(
}
}
// Parse the command for hyprland dispatch
let dispatch_type = match action {
"on" => {
if let Some(monitor_name) = monitor {
DispatchType::Custom("dpms", &format!("on {}", monitor_name))
} else {
DispatchType::Custom("dpms", "on")
// Execute the command via hyprland dispatch
match (action, monitor) {
("on", Some(monitor_name)) => {
let command_str = format!("on {}", monitor_name);
Dispatch::call(DispatchType::Custom("dpms", &command_str))?;
}
("on", None) => {
Dispatch::call(DispatchType::Custom("dpms", "on"))?;
}
"off" => {
if let Some(monitor_name) = monitor {
DispatchType::Custom("dpms", &format!("off {}", monitor_name))
} else {
DispatchType::Custom("dpms", "off")
("off", Some(monitor_name)) => {
let command_str = format!("off {}", monitor_name);
Dispatch::call(DispatchType::Custom("dpms", &command_str))?;
}
("off", None) => {
Dispatch::call(DispatchType::Custom("dpms", "off"))?;
}
_ => return Err("Invalid action".into()),
};
Dispatch::call(dispatch_type)?;
Ok(())
}