Merge branch 'dev' into rc
This commit is contained in:
@@ -2,13 +2,26 @@
|
||||
|
||||
# omarchy:summary=Set up hibernation with swap and boot resume configuration
|
||||
# omarchy:requires-sudo=true
|
||||
# omarchy:args=[--force] [--no-rebuild]
|
||||
|
||||
FORCE=false
|
||||
NO_REBUILD=false
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--force) FORCE=true ;;
|
||||
--no-rebuild) NO_REBUILD=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ! -f /sys/power/image_size ]]; then
|
||||
echo -e "Hibernation is not supported on your system" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v limine-mkinitcpio &>/dev/null; then
|
||||
# When --no-rebuild is set, the caller is responsible for the UKI rebuild
|
||||
# (e.g. running before limine-mkinitcpio-hook is installed during initial
|
||||
# install), so we only require limine-mkinitcpio when we'd invoke it ourselves.
|
||||
if ! $NO_REBUILD && ! command -v limine-mkinitcpio &>/dev/null; then
|
||||
echo "Skipping hibernation setup (requires Limine bootloader)"
|
||||
exit 0
|
||||
fi
|
||||
@@ -26,15 +39,14 @@ if [[ -f $MKINITCPIO_CONF ]] && grep -q "^HOOKS+=(resume)$" "$MKINITCPIO_CONF";
|
||||
echo "Fixing empty resume_offset ($RESUME_OFFSET)"
|
||||
sudo sed -i "s/resume_offset=\"$/resume_offset=$RESUME_OFFSET\"/" "$RESUME_DROP_IN"
|
||||
sudo sed -i "s/resume_offset=\"$/resume_offset=$RESUME_OFFSET\"/" /etc/default/limine
|
||||
sudo limine-mkinitcpio
|
||||
sudo limine-update
|
||||
$NO_REBUILD || sudo limine-mkinitcpio
|
||||
fi
|
||||
fi
|
||||
echo "Hibernation is already set up"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $1 != "--force" ]]; then
|
||||
if ! $FORCE; then
|
||||
MEM_TOTAL_HUMAN=$(free --human | awk '/Mem/ {print $2}')
|
||||
if ! gum confirm "Use $MEM_TOTAL_HUMAN on boot drive to make hibernation available?"; then
|
||||
exit 0
|
||||
@@ -105,13 +117,16 @@ if grep -q "\[s2idle\]" /sys/power/mem_sleep 2>/dev/null; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Regenerate initramfs and boot entry
|
||||
echo "Regenerating initramfs..."
|
||||
sudo limine-mkinitcpio
|
||||
sudo limine-update
|
||||
if ! $NO_REBUILD; then
|
||||
# limine-mkinitcpio rebuilds initramfs/UKI for all kernels and updates the
|
||||
# /boot/limine.conf entries via limine-entry-tool. The limine bootloader
|
||||
# binary on the ESP doesn't change here, so we don't need limine-update
|
||||
# (which would also re-deploy the binary and rebuild a second time).
|
||||
echo "Regenerating initramfs..."
|
||||
sudo limine-mkinitcpio
|
||||
echo
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
if [[ $1 != "--force" ]] && gum confirm "Reboot to enable hibernation?"; then
|
||||
if ! $FORCE && ! $NO_REBUILD && gum confirm "Reboot to enable hibernation?"; then
|
||||
omarchy-system-reboot
|
||||
fi
|
||||
|
||||
@@ -33,4 +33,15 @@ fi
|
||||
NEW_SCALE=${SCALES[$NEW_IDX]}
|
||||
|
||||
hyprctl keyword monitor "$ACTIVE_MONITOR,${WIDTH}x${HEIGHT}@${REFRESH_RATE},auto,$NEW_SCALE"
|
||||
|
||||
# Persist to monitors.conf if the user has a single generic catch-all line
|
||||
# (ignoring disabled monitors), so the scale survives reboots.
|
||||
MONITOR_CONF="$HOME/.config/hypr/monitors.conf"
|
||||
if [[ -f "$MONITOR_CONF" ]]; then
|
||||
mapfile -t ACTIVE_LINES < <(grep -E '^[[:space:]]*monitor=' "$MONITOR_CONF" | grep -vE 'disable[[:space:]]*$')
|
||||
if [[ ${#ACTIVE_LINES[@]} -eq 1 ]] && [[ "${ACTIVE_LINES[0]}" =~ ^monitor=,preferred,auto, ]]; then
|
||||
sed -i -E "s|^(monitor=,preferred,auto,).*|\\1${NEW_SCALE}|" "$MONITOR_CONF"
|
||||
fi
|
||||
fi
|
||||
|
||||
notify-send -u low " Display scaling set to ${NEW_SCALE}x"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
run_logged $OMARCHY_INSTALL/login/plymouth.sh
|
||||
run_logged $OMARCHY_INSTALL/login/default-keyring.sh
|
||||
run_logged $OMARCHY_INSTALL/login/sddm.sh
|
||||
run_logged $OMARCHY_INSTALL/login/hibernation.sh
|
||||
run_logged $OMARCHY_INSTALL/login/limine-snapper.sh
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Run before limine-snapper.sh so the resume hook + cmdline drop-ins are in
|
||||
# place when `pacman -S limine-mkinitcpio-hook` triggers its single full UKI
|
||||
# rebuild. The --no-rebuild flag tells the script to skip its own rebuild —
|
||||
# limine-snapper's pacman install will produce a UKI that already includes
|
||||
# hibernation.
|
||||
omarchy-hibernation-setup --force --no-rebuild
|
||||
@@ -80,11 +80,17 @@ fi
|
||||
|
||||
echo "mkinitcpio hooks re-enabled"
|
||||
|
||||
sudo limine-update
|
||||
|
||||
# Verify that limine-update actually added boot entries
|
||||
# Installing limine-mkinitcpio-hook above already triggered a full UKI rebuild
|
||||
# (via 80-limine-efi-deploy.hook + 90-mkinitcpio-install.hook), which writes the
|
||||
# boot entries into /boot/limine.conf. Only fall back to limine-update if those
|
||||
# hooks didn't run for some reason — running it unconditionally rebuilds every
|
||||
# UKI a second time.
|
||||
if ! grep -q "^/+" /boot/limine.conf; then
|
||||
echo "Error: limine-update failed to add boot entries to /boot/limine.conf" >&2
|
||||
sudo limine-update
|
||||
fi
|
||||
|
||||
if ! grep -q "^/+" /boot/limine.conf; then
|
||||
echo "Error: failed to add boot entries to /boot/limine.conf" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
run_logged $OMARCHY_INSTALL/post-install/hibernation.sh
|
||||
run_logged $OMARCHY_INSTALL/post-install/pacman.sh
|
||||
source $OMARCHY_INSTALL/post-install/allow-reboot.sh
|
||||
source $OMARCHY_INSTALL/post-install/finished.sh
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Enable hibernation
|
||||
omarchy-hibernation-setup --force
|
||||
Reference in New Issue
Block a user