From 834464a527847540bbb24d29415b804e940ca616 Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Sun, 19 Oct 2025 23:00:23 +0200 Subject: [PATCH] Fix: fixed ac_command/bat_command --- asusd/src/ctrl_platform.rs | 2 +- rog-control-center/src/notify.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/asusd/src/ctrl_platform.rs b/asusd/src/ctrl_platform.rs index 65e57c5f..a36328a7 100644 --- a/asusd/src/ctrl_platform.rs +++ b/asusd/src/ctrl_platform.rs @@ -167,7 +167,7 @@ impl CtrlPlatform { .map(|s| s.to_string()) .collect() }; - if prog.len() > 1 { + if (!prog.is_empty()) && (!prog[0].is_empty()) { let mut cmd = Command::new(&prog[0]); for arg in prog.iter().skip(1) { cmd.arg(arg); diff --git a/rog-control-center/src/notify.rs b/rog-control-center/src/notify.rs index f7128a8f..3302b51e 100644 --- a/rog-control-center/src/notify.rs +++ b/rog-control-center/src/notify.rs @@ -116,26 +116,26 @@ pub fn start_notifications( if p == 0 && p != last_state { let prog: Vec<&str> = bat.split_whitespace().collect(); - if prog.len() > 1 { + if (!prog.is_empty()) && (!prog[0].is_empty()) { let mut cmd = Command::new(prog[0]); for arg in prog.iter().skip(1) { cmd.arg(*arg); } cmd.spawn() - .map_err(|e| error!("AC command error: {e:?}")) + .map_err(|e| error!("Battery power command error: {e:?}")) .ok(); } } else if p != last_state { let prog: Vec<&str> = ac.split_whitespace().collect(); - if prog.len() > 1 { + if (!prog.is_empty()) && (!prog[0].is_empty()) { let mut cmd = Command::new(prog[0]); for arg in prog.iter().skip(1) { cmd.arg(*arg); } cmd.spawn() - .map_err(|e| error!("AC command error: {e:?}")) + .map_err(|e| error!("AC power command error: {e:?}")) .ok(); } }