Wait for ttfx before closing its terminal (#6773)

This commit is contained in:
Grant Wiley
2026-08-13 11:46:45 +02:00
committed by GitHub
parent 5f74a996c7
commit f6fd2e705a
2 changed files with 11 additions and 7 deletions
+2
View File
@@ -21,4 +21,6 @@ fi
# Avoid running screensaver when locked # Avoid running screensaver when locked
pkill -x ttfx 2>/dev/null || true pkill -x ttfx 2>/dev/null || true
# ttfx handles SIGTERM asynchronously, so keep its terminal alive until it exits.
timeout 1s pidwait -x ttfx 2>/dev/null || true
pkill -f '[o]rg.omarchy.screensaver' 2>/dev/null || true pkill -f '[o]rg.omarchy.screensaver' 2>/dev/null || true
+9 -7
View File
@@ -11,7 +11,7 @@ mock_bin="$tmpdir/bin"
call_log="$tmpdir/calls" call_log="$tmpdir/calls"
mkdir -p "$mock_bin" mkdir -p "$mock_bin"
for command in omarchy-shell hyprctl pkill; do for command in omarchy-shell hyprctl pkill timeout; do
cat >"$mock_bin/$command" <<'SH' cat >"$mock_bin/$command" <<'SH'
#!/bin/bash #!/bin/bash
printf '%s %s\n' "$(basename "$0")" "$*" >>"$CALL_LOG" printf '%s %s\n' "$(basename "$0")" "$*" >>"$CALL_LOG"
@@ -25,10 +25,12 @@ SH
chmod +x "$mock_bin"/* chmod +x "$mock_bin"/*
PATH="$mock_bin:$PATH" CALL_LOG="$call_log" "$ROOT/bin/omarchy-system-lock" PATH="$mock_bin:$PATH" CALL_LOG="$call_log" "$ROOT/bin/omarchy-system-lock"
mapfile -t kills < <(rg '^pkill ' "$call_log") mapfile -t shutdown < <(rg '^(pkill|timeout) ' "$call_log")
[[ ${kills[0]} == "pkill -x ttfx" ]] || [[ ${shutdown[0]} == "pkill -x ttfx" ]] ||
fail "system lock stops ttfx before closing its terminal" "calls: ${kills[*]}" fail "system lock stops ttfx before closing its terminal" "calls: ${shutdown[*]}"
[[ ${kills[1]} == "pkill -f [o]rg.omarchy.screensaver" ]] || [[ ${shutdown[1]} == "timeout 1s pidwait -x ttfx" ]] ||
fail "system lock closes the screensaver terminal after ttfx" "calls: ${kills[*]}" fail "system lock waits for ttfx to exit" "calls: ${shutdown[*]}"
pass "system lock stops ttfx before closing its terminal" [[ ${shutdown[2]} == "pkill -f [o]rg.omarchy.screensaver" ]] ||
fail "system lock closes the screensaver terminal after ttfx exits" "calls: ${shutdown[*]}"
pass "system lock waits for ttfx before closing its terminal"