Repository navigation
Prefer logind's LidClosed over raw ACPI for lid detection - #9754
bbishdotdev wants to merge 1 commit into
Conversation
logind reads the lid switch through evdev with hardware quirk handling; raw ACPI _LID can report stale state, observed on a Razer Blade Stealth 13 (Late 2019) reporting closed for over an hour of lid-open use. Every external-monitor hotplug then entered clamshell mode and blanked the internal panel, and the stale answer also skipped the PAM fingerprint gate on an open laptop. Keep the ACPI loop as the fallback for contexts without a running logind, such as install chroots, behind an OMARCHY_ACPI_LID_PATH seam matching the other hw- probes, so the new test drives both branches from fixtures.
|
Confirming this on real Apple Silicon hardware, since the failure it fixes is invisible without a lid to close. Machine: MacBookPro17,1 (M1), Asahi, aarch64. No logind's property is present and live here: It is declared Closed case, against a real lid close rather than a stub. Polling the property and the helper together at 5 Hz across an actual close-and-reopen: The The underlying source, for the record: the lid is Preferring logind over ACPI rather than the other way round also looks correct to me beyond the no-ACPI case: I wrote the inverse first and it is weaker, since it cannot address the stale One optional suggestion for the test, take it or leave it: two cases that fall out of this shape and are cheap to add are logind outranks ACPI when both answer and disagree (pins the precedence this PR establishes), and neither source answers (asserts it reports not-closed and stays quiet, which matters because |
|
Automated duplication check: this pull request looks similar to #7951, which covers the same lid detection via logind. I keep that one open and close this one to consolidate review. If you feel this is the wrong decision, please open the PR again with a note on the difference. |
|
This needs to be re-opened. This got closed as a dupe comparing to an Apple Silicon issue and then that one got closed as being a wrong assessment. I'm still running my forked Omarchy with this change in place. It has nothing to do with Apple Silicon. |
Fixes #9753.
omarchy-hw-laptop-closedtrusted/proc/acpi/button/lid/*/statealone. Firmware_LIDmethods can report stale state. On my Razer Blade Stealth 13 (Late 2019), ACPI reportedclosedfor over an hour of lid-open use, so every external-monitor hotplug entered clamshell mode and blanked the internal panel, while logind had the correct answer the whole time from the evdev lid switch:This asks logind first and keeps the ACPI loop as the fallback:
busctl get-property ... org.freedesktop.login1.Manager LidClosed, parsed asb true/b false.OMARCHY_ACPI_LID_PATHseam matching the otherhw-probes (OMARCHY_DRM_PATH,OMARCHY_USB_DEVICES_PATH, ...).No new dependencies; busctl ships with systemd.
test/shell.d/hw-laptop-closed-test.shpins five behaviors from fixtures: logind-closed, logind-open despite stale ACPI (the bug), and the three ACPI fallback states (closed, open, no lid device). Against the old script the stale-ACPI scenario fails; against this change all five pass:The source pin in
monitor-recovery-test.shis updated to match the new mechanism.Callers affected beyond clamshell: the PAM fingerprint gate in
/etc/pam.d/sudoand/etc/pam.d/polkit-1runs this as root at auth time (busctl uses the system bus by default; unreachable D-Bus falls back to ACPI as today), andPolkitAgent.qmlsamples it per auth request. The stale-ACPI failure mode mis-answers those consumers too, so they are corrected together.Verified on the affected hardware: with ACPI stuck on closed and the lid open, the old script reported closed and the clamshell path disabled eDP-1 on hotplug; the new script follows logind and the panel stays up.
./test/clipasses;./test/shellmatches the base commit (the four failures on my machine fail identically on a clean checkout of the base and want a live Omarchy runtime).