Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/omarchy-update-stay-awake
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
8 changes: 8 additions & 0 deletions test/shell.d/update-lock-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down