diff --git a/Cargo.lock b/Cargo.lock index c064a50..fff21c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -616,7 +616,7 @@ dependencies = [ [[package]] name = "moonset" -version = "0.9.1" +version = "0.9.2" dependencies = [ "dirs", "gdk-pixbuf", diff --git a/Cargo.toml b/Cargo.toml index 76c9024..01c6201 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moonset" -version = "0.9.1" +version = "0.9.2" edition = "2024" description = "Wayland session power menu with GTK4 and Layer Shell" license = "MIT" diff --git a/src/power.rs b/src/power.rs index 311ff4e..b969de1 100644 --- a/src/power.rs +++ b/src/power.rs @@ -112,7 +112,7 @@ fn run_command(action: &'static str, program: &str, args: &[&str]) -> Result<(), /// moonlock runs independently until the user unlocks. pub fn lock() -> Result<(), PowerError> { log::debug!("Power action: lock (spawning moonlock)"); - Command::new("/usr/bin/moonlock") + Command::new("moonlock") .stdin(Stdio::null()) .stdout(Stdio::null()) .stderr(Stdio::inherit()) @@ -148,7 +148,7 @@ fn resolve_logout_command( match session_id { Some(id) if !id.is_empty() => Ok(vec![ - "/usr/bin/loginctl".to_string(), + "loginctl".to_string(), "terminate-session".to_string(), id.to_string(), ]), @@ -173,17 +173,17 @@ pub fn logout() -> Result<(), PowerError> { /// Hibernate the system via systemctl. pub fn hibernate() -> Result<(), PowerError> { - run_command("hibernate", "/usr/bin/systemctl", &["hibernate"]) + run_command("hibernate", "systemctl", &["hibernate"]) } /// Reboot the system via systemctl. pub fn reboot() -> Result<(), PowerError> { - run_command("reboot", "/usr/bin/systemctl", &["reboot"]) + run_command("reboot", "systemctl", &["reboot"]) } /// Shut down the system via systemctl. pub fn shutdown() -> Result<(), PowerError> { - run_command("shutdown", "/usr/bin/systemctl", &["poweroff"]) + run_command("shutdown", "systemctl", &["poweroff"]) } #[cfg(test)] @@ -237,7 +237,7 @@ mod tests { #[test] fn logout_default_uses_loginctl_with_session_id() { let parts = resolve_logout_command(None, Some("3")).unwrap(); - assert_eq!(parts, vec!["/usr/bin/loginctl", "terminate-session", "3"]); + assert_eq!(parts, vec!["loginctl", "terminate-session", "3"]); } #[test]