From 438f7b3340b3468cb82ff6e5d218b6c7ef50f165 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 12 Aug 2026 20:05:10 +0200 Subject: [PATCH] Stop ttfx before closing the screensaver terminal (#6764) --- bin/omarchy-system-lock | 1 + test/shell.d/system-lock-test.sh | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 test/shell.d/system-lock-test.sh diff --git a/bin/omarchy-system-lock b/bin/omarchy-system-lock index d9865e9f..3c9ea6b5 100755 --- a/bin/omarchy-system-lock +++ b/bin/omarchy-system-lock @@ -20,4 +20,5 @@ if pgrep -x "1password" >/dev/null && omarchy-cmd-present 1password; then fi # Avoid running screensaver when locked +pkill -x ttfx 2>/dev/null || true pkill -f '[o]rg.omarchy.screensaver' 2>/dev/null || true diff --git a/test/shell.d/system-lock-test.sh b/test/shell.d/system-lock-test.sh new file mode 100755 index 00000000..05eb9811 --- /dev/null +++ b/test/shell.d/system-lock-test.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -euo pipefail + +source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" + +tmpdir=$(mktemp -d) +trap 'rm -rf "$tmpdir"' EXIT + +mock_bin="$tmpdir/bin" +call_log="$tmpdir/calls" +mkdir -p "$mock_bin" + +for command in omarchy-shell hyprctl pkill; do + cat >"$mock_bin/$command" <<'SH' +#!/bin/bash +printf '%s %s\n' "$(basename "$0")" "$*" >>"$CALL_LOG" +SH +done + +cat >"$mock_bin/pgrep" <<'SH' +#!/bin/bash +exit 1 +SH +chmod +x "$mock_bin"/* + +PATH="$mock_bin:$PATH" CALL_LOG="$call_log" "$ROOT/bin/omarchy-system-lock" +mapfile -t kills < <(rg '^pkill ' "$call_log") + +[[ ${kills[0]} == "pkill -x ttfx" ]] || + fail "system lock stops ttfx before closing its terminal" "calls: ${kills[*]}" +[[ ${kills[1]} == "pkill -f [o]rg.omarchy.screensaver" ]] || + fail "system lock closes the screensaver terminal after ttfx" "calls: ${kills[*]}" +pass "system lock stops ttfx before closing its terminal"