Skip to content

fix(desktop): PTT on a second display responds to the first press - #12646

Merged
kodjima33 merged 1 commit into
mainfrom
kodjima33/ptt-second-monitor
Sep 3, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
kodjima33/ptt-second-monitor

Conversation

@kodjima33

@kodjima33 kodjima33 commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Push-to-talk on a second display gave no start sound and no listening animation on the first press; the second press worked.

handleKeyShortcutDown revealed the bar and then dropped the very press that revealed it:

if !FloatingControlBarManager.shared.isVisible { FloatingControlBarManager.shared.show() }
guard FloatingControlBarManager.shared.isVisible else { return }   // ← press discarded here
handleShortcutDown()

handleShortcutDown → startListening() is what plays the start sound and puts the bar into its listening presentation, so neither happened. On a second display the bar is re-placed as it follows the cursor (followed cursor to screen …, reconciled screen change … in the logs), so it is routinely not yet visible at press time and the first press was lost every time — while on the built-in display the bar is usually already showing, which is why it only reproduced on the external monitor.

The same gate discarded the first tap of a double tap, which is why locked mode also did not work on the second display.

The revealing press now proceeds to handleShortcutDown, and the modifier-only double-tap lock path is no longer gated on bar visibility.

Verification

omi-doubletap dev bundle, with the floating bar on the second display (floatingBarFrame {{4856, 1330}, …}, usesNotchIsland false):

  • two quick taps → locked=true, phase locked_recording
  • log: modifier-only double tap — entering locked listening → entered locked listening mode (mode=locked)

Not verified by me: the start sound and the listening animation on a physical key press on the external monitor — that needs a real keypress on Nik's hardware, which I don't drive. The mechanism is the same dropped call (startListening() is where both the sound and the listening state come from), and locking on the second display is now proven, but the audible/visual result on a physical press is unconfirmed.

Invariants: INV-VOICE-1.
Failure-Class: none

Review in cubic

handleKeyShortcutDown revealed the bar and then dropped the very press that
revealed it (guard isVisible else return). startListening never ran, so there was
no start sound and no listening animation until a second press. On a second
display the bar is re-placed as it follows the cursor, so it is routinely not yet
visible and the first press was lost every time. The same gate discarded the first
tap of a double tap, which is why locked mode did not work there either.

The revealing press now proceeds to handleShortcutDown, and the modifier-only
double-tap lock path is no longer gated on bar visibility.

Failure-Class: none
@kodjima33
kodjima33 merged commit 15eca77 into main Sep 3, 2026
@kodjima33
kodjima33 deleted the kodjima33/ptt-second-monitor branch September 3, 2026 04:14
kodjima33 added a commit that referenced this pull request Sep 3, 2026
Follow-up to #12646. Replaces a tautological policy (`startsTurn` was
hard-coded `true`) with a seam both shipping PTT entry points run
through, and asserts the reveal-then-start ordering that the fix depends
on.

```
hidden bar press      -> [reveal, start]
visible bar press     -> [start]
hidden bar double tap -> [reveal, enterLockedListening]
```

These fail against the pre-fix code, where the handler returned before
`handleShortcutDown()`.

Verification: `swift test --filter PushToTalkShortcutActivationTests` —
11 tests, 0 failures.

Failure-Class: none
kodjima33 added a commit that referenced this pull request Sep 3, 2026
…12657)

Follow-up to #12646/#12653. The reveal-policy enum had been inserted
between `ModifierOnlyPTTActivationGate`'s documentation and the struct
itself, so the gate's docs read as the policy's. Each type now carries
its own comment.

No behaviour change. `swift test --filter
PushToTalkShortcutActivationTests` — 11 tests, 0 failures.

Failure-Class: none
Git-on-my-level added a commit that referenced this pull request Sep 4, 2026
## Summary

The macOS desktop still shipped ~7,200 lines of retired step-wizard
onboarding (`OnboardingView` and its step views). Nothing live mounts
that wizard: `DesktopHomeView` presents `SBOnboardingView`, and we are
keeping that flow (including the three-doors demo). This PR deletes the
unmounted SwiftUI views and their dedicated tests.

Two types lived in those files but still have live callers, so they were
extracted rather than deleted:

- `OnboardingChatPersistence` — used by `SBOnboardingModel`,
`OnboardingPagedIntroCoordinator`, `OnboardingRerunPolicy`,
`AuthService`, `AppState`, and `ChatToolExecutor` to persist
mid-onboarding state across restarts and sign-out.
- `AnimatedGIFView` — used by `PermissionsPage` and
`BrowserExtensionSetup`.

The screenshot-export harness no longer constructs `OnboardingView`.
Comments in `ChatToolExecutor` and `FloatingControlBarWindow` no longer
name the deleted chat view. Tests that inspected the deleted files were
trimmed; `ShortcutSettingsTests` now persist presets through the live
`SBOnboardingModel.pickShortcut` API.

## Failure class

Failure-Class: none

## Product invariants affected

`scripts/pr-preflight --suggest` reported none; the full
`--pr-body-file` run required **INV-CHAT-1** because
`ChatToolExecutor.swift` and `FloatingControlBarWindow.swift` match that
glob.

Path-glob check of the files this PR touches:

- **INV-UI-1** matches `desktop/macos/Desktop/Sources/**`. Its PR rule
opts out of naming; the brand ratchet still applies. This change only
deletes UI and extracts existing chrome — it does not add purple.
- **INV-CHAT-1** matches `ChatToolExecutor.swift` and
`FloatingControlBarWindow.swift`. Both edits are comments only. The live
onboarding entry point (`DesktopHomeView` → `SBOnboardingView`) and the
chat write path are unchanged.

Every deletion is a file whose SwiftUI type had no live mount. Shared
helpers that still have live referents were kept (`OnboardingFlow`,
`OnboardingPromptSuggestions` / `PostOnboardingPromptSuggestions`,
`OnboardingAnswerWriteGate`, `OnboardingImportEvidenceService`,
`OnboardingMemoryLogImportService`, `OnboardingWebResearchService`,
`OnboardingPagedIntroCoordinator`, `OnboardingGlassChrome`,
`PermissionDragGuidance`, `OnboardingRerunPolicy`).

## Verification

- `scripts/pr-preflight --pr-body-file PR-BODY.md` — **passed, 22
checks** (same manifest the pre-push hook runs). First pass failed
`desktop-swiftlint` on `omi_inline_userdefaults_key` in the extracted
`OnboardingChatPersistence.clear()` (inline `"onboardingACPSessionId"` /
`"onboardingChatMessages"`). Fixed by adding those keys to `DefaultsKey`
and calling `removeObject(forKey: .…)`. Did not touch the SwiftLint
baseline and did not add `swiftlint:disable`.
- `cd desktop/macos && xcrun swift build -c debug --package-path
Desktop` — passed (after extracting the two live types that first failed
to compile).
- `python3 desktop/macos/scripts/check_desktop_test_quality.py` —
passed; ratcheted `SOURCE_INSPECTION_SITE_BASELINE` 147 → 146.
- `python3 desktop/macos/scripts/desktop-flow-lint.py` —
`desktop-flow-lint OK (74 flows, 188 registered actions)`.
- `desktop/macos/scripts/swift-format-wrapper.sh lint` on every changed
Swift file — clean.
- `xcrun swift test --package-path Desktop --filter
'OnboardingFlowTests|GoalGenerationServiceTests|AgentVMWarmupAdoptionTests|ShortcutSettingsTests|OnboardingPermissionToolTests|OnboardingPersistenceClearingTests|OnboardingGlassChromeTests|OnboardingRerunPolicyTests'`
— 78 tests, 0 failures.
- `xcrun swift test --package-path Desktop` (unfiltered) — compiled and
ran hundreds of suites with 0 XCTest failures, then the `xctest` process
aborted with signal 6 during `FloatingBarUsageLimiterTests` (not touched
by this PR).
- `desktop/macos/scripts/swift-test-suites.sh` — 745 suites in
isolation. One failure:
`HubEscalationTests.testPublicWebPromptIsSpeakableAndExcludesPrivateToolContext`
(`XCTAssertTrue` at `HubEscalationTests.swift:87`).
- **HubEscalation A/B:** same filter on a throwaway worktree detached at
clean `origin/main` `15eca77b622ee5ed84d3542a46a4027993f69896`
(`fix(desktop): PTT on a second display responds to the first press
(#12646)`). Identical failure: `XCTAssertTrue` at
`HubEscalationTests.swift:87` in
`testPublicWebPromptIsSpeakableAndExcludesPrivateToolContext`. This
branch did not cause it.
- **FloatingBarUsageLimiterTests A/B:** the same `origin/main` SHA ran
`FloatingBarUsageLimiterTests` to completion — 18 tests, 0 failures, no
signal-6 abort. The abort was only seen in an unfiltered full-package
run on this branch; this PR does not touch limiter sources. Cheap check
does not reproduce it on `origin/main`.
- `desktop/macos/scripts/run-swift-ci.sh --select-toolchain` — failed:
`Xcode 16.4` is not installed at `/Applications/Xcode_16.4.app`. Local
`swift build` therefore cannot see the strict-concurrency errors CI
rejects.
- Named-bundle first-run walkthrough was not run: this PR does not
change the live onboarding path.

## Line-count exceptions

None. New code went into new files (`OnboardingChatPersistence.swift`,
`AnimatedGIFView.swift`).

Line delta vs this branch's merge-base (`git diff --stat
8cf10a6...HEAD`): **37 files, 127 insertions, 7573 deletions**.

`git diff --stat origin/main` as requested: **52 files, 182 insertions,
8796 deletions**. That mix is not this PR: COMMON.md forbade rebasing,
and this worktree is now 2 commits ahead / 4 behind `origin/main`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/12652?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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.

1 participant