diff --git a/bin/omarchy-update-stay-awake b/bin/omarchy-update-stay-awake index 5fd9eb151b5..56d99e369c1 100755 --- a/bin/omarchy-update-stay-awake +++ b/bin/omarchy-update-stay-awake @@ -101,14 +101,14 @@ start() { if [[ -n ${OMARCHY_UPDATE_LOCK_FD:-} ]]; then "${inhibit_runner[@]}" systemd-inhibit \ - --what=sleep:idle \ + --what=sleep:idle:handle-lid-switch \ --who=omarchy-update \ --why="Omarchy update in progress" \ --mode=block \ sleep infinity >/dev/null 2>&1 {OMARCHY_UPDATE_LOCK_FD}>&- & else "${inhibit_runner[@]}" systemd-inhibit \ - --what=sleep:idle \ + --what=sleep:idle:handle-lid-switch \ --who=omarchy-update \ --why="Omarchy update in progress" \ --mode=block \ diff --git a/test/shell.d/update-lock-test.sh b/test/shell.d/update-lock-test.sh index 6c65428dc89..64f7b2fd63a 100644 --- a/test/shell.d/update-lock-test.sh +++ b/test/shell.d/update-lock-test.sh @@ -151,6 +151,14 @@ SH [[ ! -e $pkexec_marker ]] || fail "terminal sleep inhibition does not use pkexec" run_with_lock_env "$ROOT/bin/omarchy-update-stay-awake" stop pass "terminal updates use sudo instead of Polkit for sleep inhibition" + + # The sudo stub logs the whole systemd-inhibit argv, which is the only place + # the inhibitor's --what mask is observable. sleep and idle are high-level + # locks that logind ignores for the lid switch by default, so without + # handle-lid-switch closing the lid suspends the machine mid-update. + grep -q -- '--what=sleep:idle:handle-lid-switch' "$sudo_log" || + fail "update sleep inhibition covers the lid switch" + pass "update sleep inhibition covers the lid switch" fi # Update-owned Stay Awake state must be cleared before the restart helper can