Add option to enable/disable hibernation (#4103)

* Add option to enable/disable hibernation

* Actually do it

* Match hibernation toggle words

* Both enable and disable

* Match the tense

* Match options

* Remove excess CR
This commit is contained in:
David Heinemeier Hansson
2026-01-06 22:36:40 +01:00
committed by GitHub
parent 3a4536059a
commit 3dbebd7a4d
4 changed files with 141 additions and 10 deletions

View File

@@ -0,0 +1,18 @@
#!/bin/bash
# Check if hibernation is supported
if [[ ! -f /sys/power/image_size ]]; then
exit 1
fi
# Sum all swap sizes (excluding zram)
SWAPSIZE_KB=$(awk '!/Filename|zram/ {sum += $3} END {print sum+0}' /proc/swaps)
SWAPSIZE=$(( 1024 * ${SWAPSIZE_KB:-0} ))
HIBERNATION_IMAGE_SIZE=$(cat /sys/power/image_size)
if [[ "$SWAPSIZE" -gt "$HIBERNATION_IMAGE_SIZE" ]] && [[ -f /etc/mkinitcpio.conf.d/omarchy_resume.conf ]]; then
exit 0
else
exit 1
fi