Fix power action terminal scope race

Co-authored-by: Jon Kinney <jonkinney@gmail.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-19 10:31:27 -07:00
co-authored by Jon Kinney
parent 1feb0250b4
commit ec9f8241c1
3 changed files with 76 additions and 6 deletions
+4 -3
View File
@@ -4,10 +4,11 @@
# omarchy:examples=omarchy reboot | omarchy system reboot
# omarchy:aliases=omarchy reboot
omarchy-state clear re*-required
# Schedule the reboot in the user manager so closing the terminal's systemd
# scope cannot terminate it before it runs.
systemd-run --user --collect --quiet --on-active="2s" systemctl reboot --no-wall || exit 1
# Schedule the reboot to happen after closing windows (detached from terminal)
nohup bash -c "sleep 2 && systemctl reboot --no-wall" >/dev/null 2>&1 &
omarchy-state clear re*-required
# Now close all windows
omarchy-hyprland-window-close-all
+4 -3
View File
@@ -4,10 +4,11 @@
# omarchy:examples=omarchy shutdown | omarchy system shutdown
# omarchy:aliases=omarchy shutdown
omarchy-state clear re*-required
# Schedule the shutdown in the user manager so closing the terminal's systemd
# scope cannot terminate it before it runs.
systemd-run --user --collect --quiet --on-active="2s" systemctl poweroff --no-wall || exit 1
# Schedule the shutdown to happen after closing windows (detached from terminal)
nohup bash -c "sleep 2 && systemctl poweroff --no-wall" >/dev/null 2>&1 &
omarchy-state clear re*-required
# Now close all windows
omarchy-hyprland-window-close-all