Skip to content

capture: reach the recorder with --stop-recording even when the recordings directory is missing - #18895

Open
AnPod wants to merge 2 commits into
omacom:quattrofrom
AnPod:fix-screenrecording-stop-missing-dir
Open

AnPod wants to merge 2 commits into
omacom:quattrofrom
AnPod:fix-screenrecording-stop-missing-dir

Conversation

@AnPod

@AnPod AnPod commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Problem

omarchy capture screenrecording --stop-recording exits before contacting the recorder whenever the configured recordings directory (OMARCHY_SCREENRECORD_DIR, or the Videos directory) is missing — renamed, unmounted, or on a drive that detached. The gate at the top of the script exempted only --status, so a recording that was started before the directory disappeared could not be stopped at all: every stop request answered with the "no recordings directory" notification and exit 1, and the recorder kept running.

Output directory Exit Stop request sent
Present 0 yes
Missing 1 no

Fix

The recordings directory only names new recordings. A stop reads its path back from the runtime state file (omarchy-screenrecord-filename) and never writes into the directory, so --stop-recording now passes the gate the same way --status already does:

if [[ $STATUS != "true" && $STOP_RECORDING != "true" && ! -d $OUTPUT_DIR ]]; then

Starting a recording still refuses a missing directory with the same notification, so a start cannot fill a directory the user moved away.

Test

Extends test/shell.d/screenrecording-test.sh (after the existing stop-path blocks) using its stub recorder helper:

  • --stop-recording with a missing recordings directory and an active recording exits 0, sends --signal INT, ends the recording, notifies nothing about the directory, and clears its runtime state files.
  • --fullscreen (a start) with the same missing directory still exits 1 with the notification and never reaches a recorder.

Red-before (fix stashed) fails on exactly "stop reaches the recorder without a recordings directory"; green with the fix.

Note on the conflict surface: bin/omarchy-capture-screenrecording also has other open PRs (#18885, #18817, #18814, #18803). This change touches only the directory gate, disjoint from the arg-parsing and start/stop-path hunks in those PRs, and the test block is placed away from the regions they add.

Fixes #18874

…dings directory is missing

The recordings-directory gate fired for every run except --status, so a
stop request exited before signaling an active recorder when
OMARCHY_SCREENRECORD_DIR (or the Videos directory) had been renamed or
unmounted. The stop reads its path back from the runtime state file and
never writes into the directory, so --stop-recording now passes the gate
like --status does; starting a recording still refuses with the same
notification.

Fixes omacom#18874
@greptile-apps

greptile-apps Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Allows --stop-recording to reach the recorder when the recordings directory is missing.

  • The recorder can stop even when its save folder is missing.

Reviews (3) · Last reviewed commit: "test: harden screenrecording stop state ..." · Reviewed by Greptile

Comment thread test/shell.d/screenrecording-test.sh Resolved
@aholbreich

Copy link
Copy Markdown
Contributor

#17318 fixes the same thing and is older. It moves the directory check to the start path, so pressing the recording shortcut again also stops a recording whose folder is gone, not only --stop-recording. Worth comparing the two before either lands.

@omarchybot omarchybot added the bug Something isn't working label Nov 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Compared both diffs with the recording command, its menu/bar callers, and the tests. #17318 moves the directory check to the start path, so it also covers stopping via the no-argument or --fullscreen toggle; this change exempts only explicit --stop-recording. They are competing fixes and remain open for the maintainer's decision.

Your saved-PID stop and runtime-state cleanup checks add coverage beyond #17318's legacy-recorder test. I queued that coverage and its recorder-stub update for #17318's session to incorporate, keeping its toggle test. The start-refusal assertion will need to allow read-only recorder probes when carried over.

Reviewed by GPT-6 High in Codex, with Opus 5.5 High and muse-wonder via pi, thinking high. Both reviewers agreed on the comparison; their independence is not guaranteed. They also identified the start-test adaptation above. No worker tests were run on this alternative after the comparison. This PR is waiting on the maintainer's choice between the fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--stop-recording skips the stop request when the output directory is missing

3 participants