fix: power buttons via systemctl, single greeter window (v0.8.7)
Update PKGBUILD version / update-pkgver (push) Successful in 6s

Reboot/shutdown buttons always failed: power.rs called `loginctl
reboot|poweroff`, but loginctl has no such verbs (systemd 260) — those
belong to systemctl. moonlock/moonset already used systemctl; moongreet
was the outlier. Switch to `systemctl --no-ask-password reboot|poweroff`.

The multi-monitor greeter gave Exclusive keyboard only to the first
monitor's window, so a user focused on any other output could not type
the password. Drop the per-monitor loop + hotplug; create one window on
the focused output (no set_monitor) with Exclusive keyboard.

Polkit rule kept as a harmless safety net (it was never the blocker;
CanReboot returns yes). The missing journal errors were not a logging
bug — they were lost to a hard power-cut before journald synced.
This commit is contained in:
2026-06-02 12:03:52 +02:00
parent b9b6f50974
commit 41228605ad
8 changed files with 37 additions and 61 deletions
+12 -5
View File
@@ -1,4 +1,4 @@
// ABOUTME: Power actions — reboot and shutdown via loginctl.
// ABOUTME: Power actions — reboot and shutdown via systemctl.
// ABOUTME: Wrappers around system commands for the greeter UI.
use std::fmt;
@@ -99,14 +99,21 @@ fn run_command(action: &'static str, program: &str, args: &[&str]) -> Result<(),
}
}
/// Reboot the system via loginctl.
/// Reboot the system via systemctl.
///
/// `--no-ask-password` keeps systemctl from spawning an interactive askpass
/// agent — the greeter session has none, so without it a denied authorization
/// would hang instead of failing fast.
pub fn reboot() -> Result<(), PowerError> {
run_command("reboot", "/usr/bin/loginctl", &["reboot"])
run_command("reboot", "/usr/bin/systemctl", &["--no-ask-password", "reboot"])
}
/// Shut down the system via loginctl.
/// Shut down the system via systemctl.
///
/// `--no-ask-password` for the same reason as [`reboot`] — the agent-less
/// greeter session has nothing to answer an authorization challenge.
pub fn shutdown() -> Result<(), PowerError> {
run_command("shutdown", "/usr/bin/loginctl", &["poweroff"])
run_command("shutdown", "/usr/bin/systemctl", &["--no-ask-password", "poweroff"])
}
#[cfg(test)]