Repository navigation
Conversation
…uspend, docked ignore Battery lid-close suspends first (lid-open wakes instantly) then hibernates after 20min to stop drain; AC stays in suspend where lid-open always wakes (most firmware, incl. tested HP 250 G9, exposes no LID wakeup from S4 — only PWRB wakes from hibernate); docked stays awake for clamshell, matching omarchy-system-lid-close. HibernateOnACPower=no keeps manual suspend-then-hibernate on AC in suspend too. Installed/removed by omarchy-hibernation-setup/remove; supersedes the manual 99-suspend-then-hibernate.conf drop-in.
Jamesking56
left a comment
There was a problem hiding this comment.
This needs a migration script for people who have it enabled already.
… policy Setup installs the lid policy only on fresh runs; machines that already have hibernation hit the early exit first. Backfill both drop-ins for them, remove the superseded manual file, and reload logind (reboot fallback). No-op when hibernation is absent or policy already matches.
|
Added migration
Test: extended |
|
Re-review request — the migration you asked for is in at
That is
Worth noting why a migration was needed at all: Verified against current |
|
Policy concern from the 11,x hibernate trenches: this makes battery lid-close suspend-then-hibernate with no model gating, but hibernate resume is broken on MacBookPro11,x — #11351 (11,5: frozen lock screen, dead input, no journal) plus a bricked-11,4 confirmation, and #7848 (11,3: resume kills the GPU session). On those machines this policy turns an unattended 20-minute lid-close into a lost session. Suggest gating the battery suspend-then-hibernate path on models with known-good resume (or at minimum exempting 11,x until resume works there). The migration already branches per-machine state for hibernation presence; a DMI-based exemption would fit the same shape. |
…e is broken MacBookPro11,x loses the session when it resumes from hibernate: omacom#11351 (11,5 resumes to a frozen lock screen with dead input), omacom#7848 (11,3 kills the GPU session), plus a bricked 11,4 report. The new battery policy sends an unattended lid-close into hibernate after 20 minutes, so on those machines it trades a drained battery for a lost session. Gate the policy on DMI via omarchy-hw-match, matching the precedent in migrations/1784401744.sh, and install a battery-suspend variant instead. Both delivery paths need the gate: setup for new machines, and the migration for machines that configured hibernation before the policy existed. The migration compares against the model-appropriate source, so a machine that already received the hibernate variant is repaired. Reported by rand0mdud3.
|
You're right, and this was a real regression rather than a theoretical one — thank you for connecting it to the resume bugs. Fixed in Battery lid-close now stays in The gate is in both delivery paths, because only one of them reaches any given machine: I went with a denylist rather than the allowlist you suggested, and want to flag that as the one judgment call: gating on "models with known-good resume" would need a per-model resume database Omarchy doesn't have, and it would quietly drop the overnight-drain protection from the long tail of laptops that do resume fine. Exempting only models with a filed bug keeps the improvement where it's been observed working and removes it exactly where it costs a session. Covered by The trade, for the record: on these three models an overnight lid-close now drains battery instead of risking the session. Given "frozen lock screen, dead input, no journal" I'd take the dead battery, but that's the thing to revisit if resume is ever fixed on pre-T2 Macs. |
|
| if ! install_root_file "$OMARCHY_PATH/default/systemd/sleep.conf.d/10-omarchy-suspend-then-hibernate.conf" \ | ||
| /etc/systemd/sleep.conf.d/10-omarchy-suspend-then-hibernate.conf 0644; then |
There was a problem hiding this comment.
Missing directories block installation
If /etc/systemd/sleep.conf.d does not exist, setup tries to create a temporary file inside it and exits before writing the resume marker. The migration uses the same approach, so retrying it fails again. Neither path can install the lid-close policy until the directory is created. Create the destination directories before staging the files.
| # Remove lid-close / suspend-then-hibernate policy installed by setup. | ||
| # Logind re-reads on reboot; sleep.conf is read per suspend, so no reload needed. | ||
| echo "Removing lid-close sleep policy" | ||
| sudo rm -f /etc/systemd/logind.conf.d/99-omarchy-lid-sleep.conf | ||
| sudo rm -f /etc/systemd/sleep.conf.d/10-omarchy-suspend-then-hibernate.conf |
There was a problem hiding this comment.
Active lid policy remains stale
Removal deletes the swapfile and policy files but does not reload logind or request a reboot. Until the next reboot, logind can still use suspend-then-hibernate, so closing the lid on battery can request hibernation after the swapfile is gone. Fresh setup has the reverse delay: its new lid policy is not active until reboot. Apply or schedule the logind change in both paths, as the migration does.
| echo "Removing lid-close sleep policy" | ||
| sudo rm -f /etc/systemd/logind.conf.d/99-omarchy-lid-sleep.conf | ||
| sudo rm -f /etc/systemd/sleep.conf.d/10-omarchy-suspend-then-hibernate.conf |
There was a problem hiding this comment.
Interrupted removal strands lid policy
If removal is interrupted after it deletes the resume marker but before it deletes these policy files, a retry exits at the missing-marker check. The lid can remain configured for suspend-then-hibernate even though the swapfile has already been removed. Make policy cleanup reachable on a retry without the marker.
|
Interesting lid-close policy PR: battery → suspend-then-hibernate (20m), AC → suspend, docked → ignore, with MacBookPro11,x gated to plain suspend (#11351). Migration included for existing hibernation setups. Product call on making this the default everywhere — related open issues on docked lid-close / lock blank treating externals as undocked (#15207, #15152). Also overlaps the broader hibernation fix set (#13768, #13908, #14520). I'm +1 on the MacBookPro11 gate; the global policy change needs a maintainer decision. |
Summary
Lid-close used a static suspend-then-hibernate everywhere (or nothing upstream). This makes it dynamic with zero daemons:
Why AC stays in suspend
Waking from true hibernate via lid-open needs firmware LID wakeup from S4. Tested HP 250 G9 exposes no LID0 power/wakeup and no /proc/acpi/wakeup LID row — only PWRB wakes from S4. Suspend keeps the fast lid-open path on AC; after 20min on battery the power button is required (noted in config comments).
Changes
Test plan