Skip to content

Arm scanning automatically whenever the switches allow it - #732

Merged
enaboapps merged 2 commits into
mainfrom
feat/implicit-scanning
Sep 13, 2026
Merged

enaboapps merged 2 commits into
mainfrom
feat/implicit-scanning

Conversation

@enaboapps

Copy link
Copy Markdown
Contributor

Scanning no longer has an enable button. It is armed whenever the saved switches cover the current mode and the environment allows it, and it stays that way while Switchify runs.

Behaviour

  • The runtime reconciles on every tick while scanning is off: it arms when a Select switch exists (plus Next and Previous in manual mode), no key is being learned, Android is not connected, and input access is granted. A failed key reservation backs off two seconds between attempts.
  • Saving switches and starting key learning pause scanning instead of being refused while it runs. The Switches tab is never locked, and changes to scan settings apply straight away.
  • Escape and the emergency hold reset the scan; the keys are re-reserved on the next tick. Nothing waits for window focus.
  • Scanning arms at launch, so assigned keys are reserved from startup. Application exit halts the reconciler before shutting the input broker.
  • The Scanning tab shows the backend's message as its status line: ready, the reason scanning is off, or the current phase.

IPC

configure_point_scan drops its enabled argument. get_point_scan, the point-scan-changed event and point-scan.json keep their shapes. save_switches and begin_switch_capture no longer fail when scanning is on.

Validation

tsc, 131 frontend tests plus 5 Node tests, cargo fmt, Clippy all targets with warnings denied, 304 Rust unit tests and 7 integration tests passed on Windows. Tests use fake input and do not send desktop input.

Live check against the dev build with a real saved Space switch: scanning was armed at launch; saving a probe switch re-armed it; changing line speed while armed re-armed it; saving an empty switch list disarmed it with "Scanning starts once a switch has the Select action"; restoring the switch re-armed it. No key events were sent by the agent.

Manual checks remaining: Escape followed by re-arm on a physical switch, learning a key while scanning is armed, an Android connection ending, and a key held by another application while Switchify starts.

Builds on #731.

Scanning no longer has an enable button. The runtime arms itself when
the saved switches cover the current mode and the environment allows,
and the tick loop re-arms after anything that stopped it: a switch or
settings save, key learning, Escape, an Android session, or a failed
key reservation, which backs off two seconds between attempts. Saving
switches and starting a capture pause scanning instead of being refused
while it runs, so the Switches tab is never locked. Escape resets the
scan and the keys are re-reserved on the next tick; nothing waits for
window focus. Exit halts the reconciler before shutting the broker.

The configure command drops its enabled flag; the view keeps its shape
and the Scanning tab shows the backend's message as its status line.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR replaces the manual point-scan toggle with automatic scanning lifecycle reconciliation. It arms scanning when switch assignments and environment checks permit it, pauses safely during configuration and input-handling transitions, and re-arms when scanning becomes eligible again.

Confidence Score: 5/5

Safe to merge.

The previously reported retry-delay issue is resolved: environmental readiness failures return before retry timing is considered, while the retry delay remains limited to arm failures. enaboapps manually resolved the earlier thread without explanation.

Reviews (2): Last reviewed commit: "Re-check the environment every tick inst..." | Re-trigger Greptile

Comment thread src-tauri/src/scanning_runtime.rs
An Android connection or missing input access failed inside arm() and
started the two-second retry timer, so scanning stayed off for up to
two seconds after the condition cleared. The adapter now exposes a
pure ready() check that the reconciler polls each tick; only a failed
key reservation or overlay start backs off.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@enaboapps enaboapps added this to the v1.0.0-rc.7 milestone Sep 13, 2026
@enaboapps
enaboapps merged commit ea5205b into main Sep 13, 2026
7 checks passed
@enaboapps
enaboapps deleted the feat/implicit-scanning branch September 22, 2026 09:14
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.

2 participants