From 7fdd7877fc881c1ca833cb9a8b128502fade5bc6 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 2 May 2026 12:50:59 +0200 Subject: [PATCH 1/3] Don't rebuild limine more than necessary --- install/login/limine-snapper.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/install/login/limine-snapper.sh b/install/login/limine-snapper.sh index 06d8f93e..ce9fffbb 100644 --- a/install/login/limine-snapper.sh +++ b/install/login/limine-snapper.sh @@ -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 From aee06e4320331f7be648d47266463fd147ef4c57 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 2 May 2026 13:10:47 +0200 Subject: [PATCH 2/3] Setup hibernation more efficiently to prevent needless limine rebuilds --- bin/omarchy-hibernation-setup | 37 ++++++++++++++++++++--------- install/login/all.sh | 1 + install/login/hibernation.sh | 6 +++++ install/post-install/all.sh | 1 - install/post-install/hibernation.sh | 2 -- 5 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 install/login/hibernation.sh delete mode 100644 install/post-install/hibernation.sh diff --git a/bin/omarchy-hibernation-setup b/bin/omarchy-hibernation-setup index d88978d4..d8e32c94 100755 --- a/bin/omarchy-hibernation-setup +++ b/bin/omarchy-hibernation-setup @@ -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 diff --git a/install/login/all.sh b/install/login/all.sh index 2c03df32..4d76d3f9 100644 --- a/install/login/all.sh +++ b/install/login/all.sh @@ -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 diff --git a/install/login/hibernation.sh b/install/login/hibernation.sh new file mode 100644 index 00000000..5983020d --- /dev/null +++ b/install/login/hibernation.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 diff --git a/install/post-install/all.sh b/install/post-install/all.sh index d7caae25..bb5c0839 100644 --- a/install/post-install/all.sh +++ b/install/post-install/all.sh @@ -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 diff --git a/install/post-install/hibernation.sh b/install/post-install/hibernation.sh deleted file mode 100644 index 17628ead..00000000 --- a/install/post-install/hibernation.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Enable hibernation -omarchy-hibernation-setup --force From 7b602c984c473e407cd23a782bf23e216f2cd771 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 2 May 2026 13:31:50 +0200 Subject: [PATCH 3/3] Persist scaling choices in the common case of a single monitor declared --- bin/omarchy-hyprland-monitor-scaling-cycle | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/omarchy-hyprland-monitor-scaling-cycle b/bin/omarchy-hyprland-monitor-scaling-cycle index 24b2c015..b5aeb528 100755 --- a/bin/omarchy-hyprland-monitor-scaling-cycle +++ b/bin/omarchy-hyprland-monitor-scaling-cycle @@ -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"