diff --git a/bin/omarchy-capture-screenrecording b/bin/omarchy-capture-screenrecording index e8a440ed8486..5178f4486911 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 "$(omarchy-i18n capture.recordingError)" "$(omarchy-i18n capture.recordingKilled)" + 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 local filename=$(cat "$RECORDING_FILE" 2>/dev/null) local preview="${filename%.mp4}-preview.png" 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