feat(settings): add the opt-in switch for window contents on edges next to another display#152

merged3
main
feat/150-shared-edge-switch
opened13d agobySSamanyu Das
View on GitHubTwo-way sync enabledPR last imported 12d ago

Summary

With displays side by side, a hidden column can't leave a real slice of its window on the edge the displays share, because macOS would move that window to the other display. Issue #150 has the engine draw a photo of that slice instead, which needs Screen Recording permission. Sam wants that opt-in, off by default, and gated by a switch.

This PR adds the switch, the permission prompt, and the system-access amendment. It adds no capture code: steps 1, 2, 4, and 5 below it in the stack do that work.

  • Settings > Layout gets Show window contents on edges next to another display, with the note "Needs Screen Recording permission." It is off by default.
  • Turning it on asks macOS for Screen Recording permission. If Miri doesn't get it, the switch turns back off. It then says: "Miri does not have Screen Recording permission, so this is off. Turn on Miri in System Settings > Privacy & Security > Screen & System Audio Recording, then turn this on again." An Open Screen Recording Settings button opens that pane.
  • If the permission is gone when Miri rechecks its setup (the same check that covers Accessibility), the switch turns off with the same note.
  • The switch writes [options] shared_edge_slices. The engine from step 4 (#155) reads it to draw the slice photos, and step 5 (#157) passes clicks and drags on a photo to its window.
  • ADR 0002 is amended to allow this one opt-in use, limited to the edge slices. SECURITY.md, the spec, and the decisions/ files that said Miri needs Accessibility only now name the exception.

Stacked on #157, the last engine pin of #150 (#151 → #154 → #155 → #157 → this PR). It merges last, so the switch never asks for a permission that does nothing. It used to branch from main. On 29 October it moved onto #157. That dropped a09e30a, which had said capture was not built yet, and resolved the PROGRESS.md conflict between the two lines. a869a2d rewrites the last docs that described capture as future work, in decisions/configuration.md and PROGRESS.md.

Part of #150

Verification

  • swift test: 176 tests pass. They include the new SharedEdgeSlicesConfigurationTests (the key's read, write, and default) and ScreenRecordingTests (only turning on prompts, a denied request saves off, and a revoked grant turns the switch off). Breaking the logic or the write made 3 of them fail.

  • The pinned engine (5075a4a) parses a config with [options] shared_edge_slices = true next to real keys. This was a throwaway engine test, not committed.

  • make lint, make doctor, make swift-lint, and make build pass.

  • Live on this head's Miri Developer build on Sam's Mac, 28 October, driven through the Accessibility API:

    • Settings > Layout shows the switch off, with the footer "Needs Screen Recording permission."
    • Turning it on showed the macOS prompt: "Miri Developer.app" would like to record this computer's screen and audio. The switch turned back off at once, config.toml kept shared_edge_slices = false, and the note appeared.
    • After Deny, turning the switch on again showed no prompt. It stayed off with the note.
    • Open Screen Recording Settings opened System Settings at Screen & System Audio Recording. It listed one entry, Miri Developer.app, and no separate engine entry.
  • make check passes locally, or the skipped targets are named with the reason. Skipped e2e, because it launches Miri Developer while Sam was using it.

  • Behavior that unit tests cannot show was checked end to end, and the observed output is above. The later step 4 integration session also verified the granted path. The switch stayed on and the engine captured under the Miri Developer grant. Production signed-bundle attribution remains unverified.

  • PROGRESS.md reflects the state after this PR.

  • Final live check, 29 October: Miri Developer built from this branch's tree (all of #150) with engine e30ba61, displays side by side.

    • Turning the switch on wrote shared_edge_slices = true and drew two slices on the shared edge, one per display. The test window's slice showed its playing video.
    • Quick clicks of 30, 80, and 150 ms, a double click, and a 20-move drag on that slice reached the test window 12 pt inside its edge.
    • A second press 20 or 30 ms after the first was dropped in 3 of 3 runs, and the first press still arrived as one click.
    • Scroll over a slice is dropped, by design.
    • Turning the switch off wrote false and closed both panels.
  • After the restack: swift test (176 pass), make swift-lint, and check-docs pass. make lint fails only on compat until the engine stack merges.

Release

Adds Show window contents on edges next to another display to Settings > Layout, off by default.

Reviewed with sol-loop: 1 round with gpt-6.1-sol on high. Sol verdict: changes requested on two doc sentences, fixed in a09e30a. The restack made those sentences untrue and dropped that commit. a869a2d is a docs-only follow-up with no new Sol round.

Created with Claude Opus 5.5 in Claude Code.

🤖 Generated with Claude Code

Checks

1 failing · 2 successful
Some checks failed

Failing1

c5c9c46
Synced from GitHub

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

External image Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ba4c388a-f3bd-4dec-9378-9ac77589a7ae
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Added 3 commits

  • feat(settings): add the switch for window contents on shared edges1bbc93e
  • docs: allow opt-in Screen Recording for shared-edge slices9a0cf7a
  • docs: describe edge slices as built now that the switch sits on step 5c5c9c46