Fix collapsed floating bar stretching on notification#5843
Conversation
…toring - Add periodic permission recheck every 60 seconds during capture - Stop monitoring gracefully when permission is revoked - Send permissionLost event for UI notification - Prevents silent data loss when user revokes permission via System Settings - Fixes #5792
The bar chrome was using `frame(maxWidth: .infinity)` unconditionally, causing the dark background to stretch to fill the window width when a notification expanded the window. Now only stretches when actually expanded (hovering, AI conversation, or voice listening). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR makes two independent fixes: a SwiftUI layout fix for the floating control bar pill, and a runtime screen recording permission-revocation detector for the proactive assistants plugin.
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Timer as captureTimer
participant CF as captureFrame()
participant PC as ScreenCaptureService.checkPermission()
participant SC as screencapture CLI (subprocess)
participant SM as stopMonitoring()
Timer->>CF: fires (every ~1s)
CF->>CF: now.timeIntervalSince(lastPermissionCheckTime) >= 60?
alt Permission check due (every 60s)
CF->>PC: checkPermission() [blocks @MainActor]
PC->>SC: Process.run() + waitUntilExit()
SC-->>PC: exit code + file
PC-->>CF: Bool (granted)
alt Permission revoked
CF->>CF: sendEvent("permissionLost")
CF->>SM: stopMonitoring()
CF-->>Timer: return
end
end
CF->>CF: continue normal capture logic
Last reviewed commit: "Fix collapsed floati..." |
| let now = Date() | ||
| if now.timeIntervalSince(lastPermissionCheckTime) >= permissionCheckInterval { | ||
| lastPermissionCheckTime = now | ||
| let permissionGranted = ScreenCaptureService.checkPermission() |
There was a problem hiding this comment.
Blocking main thread with
checkPermission()
ScreenCaptureService.checkPermission() internally calls testCapturePermission(), which launches a /usr/sbin/screencapture process and calls process.waitUntilExit() — a synchronous, blocking call. Because ProactiveAssistantsPlugin is @MainActor and captureFrame() runs on the main thread, this blocks the UI thread for the full duration of the screenshot every 60 seconds, which can cause noticeable UI jank.
Consider offloading the check to a background task:
let permissionGranted = await Task.detached(priority: .utility) {
ScreenCaptureService.checkPermission()
}.valueThis pattern is already safe here since you immediately resume on @MainActor after the await.
…5843) ## Summary - Bar chrome now uses intrinsic width when collapsed instead of `maxWidth: .infinity` - Prevents the small pill from stretching to notification/window width when a floating bar notification appears - Only stretches to full width when actually expanded (hovering, AI conversation, voice listening) ## Test plan - [ ] Collapsed bar stays as small pill when notification appears below it - [ ] Hover still expands bar to full width correctly - [ ] AI conversation still renders at full width - [ ] Voice listening still renders at full width 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
maxWidth: .infinityTest plan
🤖 Generated with Claude Code