From 78bcf9049289b9727b44735d80c6ffa827b259f0 Mon Sep 17 00:00:00 2001 From: nevaforget Date: Sat, 28 Mar 2026 00:53:14 +0100 Subject: [PATCH] fix: use systemctl instead of loginctl for reboot/poweroff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit loginctl has no reboot/poweroff subcommands — these are systemctl commands. The error was silently swallowed because stderr wasn't captured and logs went to a non-existent directory. --- Cargo.lock | 2 +- src/power.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59bc404..2284076 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -693,7 +693,7 @@ dependencies = [ [[package]] name = "moonlock" -version = "0.4.0" +version = "0.4.1" dependencies = [ "env_logger", "gdk-pixbuf", diff --git a/src/power.rs b/src/power.rs index 2959686..6b50e88 100644 --- a/src/power.rs +++ b/src/power.rs @@ -37,8 +37,8 @@ fn run_command(action: &'static str, program: &str, args: &[&str]) -> Result<(), Ok(()) } -pub fn reboot() -> Result<(), PowerError> { run_command("reboot", "/usr/bin/loginctl", &["reboot"]) } -pub fn shutdown() -> Result<(), PowerError> { run_command("shutdown", "/usr/bin/loginctl", &["poweroff"]) } +pub fn reboot() -> Result<(), PowerError> { run_command("reboot", "/usr/bin/systemctl", &["reboot"]) } +pub fn shutdown() -> Result<(), PowerError> { run_command("shutdown", "/usr/bin/systemctl", &["poweroff"]) } #[cfg(test)] mod tests {