Skip to content

Make screen recording stop single-flight and prevent duplicate toasts (#11508) - #11564

Closed
Cid-oe wants to merge 1 commit into
omacom:quattrofrom
Cid-oe:fix/issue-11508-single-flight-screenrecording-stop
Closed

Cid-oe wants to merge 1 commit into
omacom:quattrofrom
Cid-oe:fix/issue-11508-single-flight-screenrecording-stop

Conversation

@Cid-oe

@Cid-oe Cid-oe commented Sep 12, 2026

Copy link
Copy Markdown

Fixes #11508

Problem

When gpu-screen-recorder takes a moment to exit after SIGINT (such as when draining queues or encoding at higher resolutions), triggering stop again (e.g. via hotkey or menu) calls stop_screenrecording concurrently. This results in:

  1. Both callers reading /tmp/omarchy-screenrecord-filename before removal and racing to generate previews and post notifications, causing duplicate toasts and broken thumbnail images.
  2. If the second call starts after the filename is cleared, it attempts preview generation and notification with an empty filename.

Fix

  1. Acquire a non-blocking lock on ${XDG_RUNTIME_DIR:-/tmp}/omarchy-screenrecord-stop.lock at the top of stop_screenrecording using exec {lock_fd}>...; flock -n "$lock_fd" || return 0.
  2. Guard thumbnail generation and notification by checking [[ -n $filename && -f $filename ]].
  3. Add regression tests in test/shell.d/screenrecording-test.sh verifying single-flight stop lock and that saved toasts are skipped when the recording file is missing.

@bjarneo

bjarneo commented Sep 21, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #11520, which covers the same screenrecording stop single-flight. I keep that one open and close this one to consolidate review.

If you feel this is the wrong decision, please open the PR again with a note on the difference.

@bjarneo bjarneo closed this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screen recording: stopping twice posts two "saved" toasts and a broken thumbnail

2 participants