From d977bbd542b6416b21030bdd94975c17d5fd0190 Mon Sep 17 00:00:00 2001 From: Omarchybot <317366263+omarchybot@users.noreply.github.com> Date: Mon, 12 Oct 2026 00:42:34 +0200 Subject: [PATCH] Announce no saved recording when stop knows of none Stopping a recorder this script did not start, with no saved pid and no recording file, still finalized and posted "Screen recording saved" for an empty name: a broken "-preview.png" thumbnail and a click that opens nothing. Now that the whole script runs under one lock, that is the last way the empty-name toast from #11508 is reached. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: Codex Medium --- bin/omarchy-capture-screenrecording | 3 +++ test/shell.d/screenrecording-test.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bin/omarchy-capture-screenrecording b/bin/omarchy-capture-screenrecording index e5269ad1b9ab..4e6386eb6482 100755 --- a/bin/omarchy-capture-screenrecording +++ b/bin/omarchy-capture-screenrecording @@ -425,6 +425,9 @@ stop_screenrecording() { if omarchy-capture-screenrecording-process "${RECORDER[@]}"; then omarchy-capture-screenrecording-process "${RECORDER[@]}" --signal KILL omarchy-notification-send -u critical -t 5000 "Screen recording error" "Recording process had to be force-killed. Video may be corrupted." + elif [[ ! -f $(cat "$RECORDING_FILE" 2>/dev/null) ]]; then + # No recording to finalize or show, as when stopping a recorder this script did not start. + : else finalize_recording local filename=$(cat "$RECORDING_FILE" 2>/dev/null) diff --git a/test/shell.d/screenrecording-test.sh b/test/shell.d/screenrecording-test.sh index c7d51035c6bd..a0d1cf59cc80 100644 --- a/test/shell.d/screenrecording-test.sh +++ b/test/shell.d/screenrecording-test.sh @@ -509,6 +509,7 @@ legacy_runtime="$tmp_dir/legacy-runtime" mkdir -p "$legacy_runtime" touch "$recording_flag" : >"$helper_calls" +rm -f "$OMARCHY_TEST_NOTIFICATION_ARGS" XDG_RUNTIME_DIR="$legacy_runtime" OMARCHY_TEST_HELPER_CALLS="$helper_calls" OMARCHY_TEST_RECORDING="$recording_flag" \ OMARCHY_SCREENRECORD_DIR="$recording_dir" \ "$ROOT/bin/omarchy-capture-screenrecording" --stop-recording >/dev/null 2>&1 || @@ -517,6 +518,8 @@ grep -Fxq -- '--signal INT' "$helper_calls" || fail "stop signals the user's recorders when no pid was saved" "$(<"$helper_calls")" ! grep -Fq -- '--signal KILL' "$helper_calls" || fail "a recorder that stops on INT is not killed" "$(<"$helper_calls")" +[[ ! -e $OMARCHY_TEST_NOTIFICATION_ARGS ]] || + fail "stop announces no saved recording when none was recorded as started" "$(<"$OMARCHY_TEST_NOTIFICATION_ARGS")" pass "without a saved pid, status and stop select the user's recorders" # The bar indicator and the menu's Stop row ask --status, so they show a stop