Make the laptop hibernate at critical battery instead of dying
Read omacom/omarchy #13256 in full. The stock values, the GetCriticalAction result "Sleep", the suspend-then-hibernate resolution, the reason the threshold and the action must change together, the exact drop-in, the real-drain confirmation near 4.81%, the 110 s snapshot time and the 10x energy-full caveat all come from that issue. On this workstation upower is 1.91.3-1, /etc/UPower/UPower.conf carries CriticalPowerAction=Auto, PercentageCritical=5.0 and PercentageAction=2.0, and the package ships /etc/UPower/UPower.conf.d/README.md, which requires the two-digit prefix and .conf suffix (70-critical-hibernate.conf matches its regex). The UPower.conf comment documents the fallback chain ending in PowerOff when Hibernate is unavailable. /usr/share/omarchy/bin/omarchy-battery-low only sends the 'Time to recharge!' notification and runs the battery-low hook. omarchy hibernation setup dispatches to omarchy-hibernation-setup through the omarchy CLI. Not exercised: no drop-in written and no upower restart here.
If hibernation is broken on your hardware, the machine powers off cleanly at 5% instead, and unsaved work is lost either way. Test a hibernate and resume on AC before relying on this. UPower's percentage can occasionally be wrong (one report showed 3% while the kernel said 33%), which would hibernate early. systemctl restart upower clears that.
Symptom
Hibernation is set up and works, but when the battery runs out the laptop just powers off hard at about 2%. The next boot runs fsck on the ESP and the journal says the previous boot was uncleanly shut down. Nothing was written to disk and my session is gone. Omarchy only shows a 'Time to recharge!' notification.
Cause
UPower decides what happens at critical battery. The stock /etc/UPower/UPower.conf (upower 1.91.3) has CriticalPowerAction=Auto and PercentageAction=2.0. Auto hands the decision to logind's Sleep(), which on a machine with hibernation resolves to suspend-then-hibernate (busctl call org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower GetCriticalAction returns "Sleep"). At 2% there is often not enough charge to suspend and then wake to write the image. Raising only the threshold makes it worse, because the machine first suspends to RAM. Omarchy's omarchy-battery-low only sends a notification and runs a hook. Reported on Omarchy 4.0.4-1 and confirmed fixed by a real battery drain.
Fix
First make sure hibernation really works on AC: systemctl hibernate must resume into the same session. On Omarchy 4 set it up with omarchy hibernation setup (see the hibernation records).
Then set the critical action to hibernate directly, with margin. Use a drop-in, since /etc/UPower/UPower.conf is package-owned. upower requires the file name to start with two digits and end in .conf:
sudo tee /etc/UPower/UPower.conf.d/70-critical-hibernate.conf <<'EOF'
[UPower]
CriticalPowerAction=Hibernate
PercentageCritical=8.0
PercentageAction=5.0
EOF
sudo systemctl restart upower
This is the same on plain Arch. If hibernation is not available, UPower falls back to PowerOff, which is still a clean shutdown rather than a dead battery.
Hibernating on battery under memory pressure took over 110 seconds in the report, so do not set PercentageAction lower than 5.
Verify
busctl call org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower GetCriticalAction
# s "Hibernate"
On a real drain, journalctl should show logind logging a hibernate requested by upowerd near 5%.