-
Notifications
You must be signed in to change notification settings - Fork 988
remove old scap and add permission check to scap-avfoundation #1337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe PR removes the Changes
Sequence Diagram(s)sequenceDiagram
participant App as Desktop App
participant Perms as permissions.rs
participant SCK as scap_screencapturekit
participant CG as CoreGraphics (FFI)
rect rgb(240, 249, 255)
Note over App,CG: macOS Screen Recording Permission Flow (New)
end
App->>Perms: check_permissions()
Perms->>SCK: has_permission()
SCK->>CG: CGPreflightScreenCaptureAccess()
CG-->>SCK: i32 (LSB = permission bit)
SCK-->>Perms: bool
Perms-->>App: permission status
alt Permission Required
App->>Perms: request_permission()
Perms->>SCK: request_permission()
SCK->>CG: CGRequestScreenCaptureAccess()
CG-->>SCK: i32 (1 = success)
SCK-->>Perms: bool
Perms-->>App: request result
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Areas that may require extra attention:
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
apps/desktop/src-tauri/src/tray.rs (1)
64-70: Remove commented-out code.The commented-out
TakeScreenshotmenu item should be deleted entirely rather than left as a comment, as the functionality has been intentionally removed per the PR objectives.Apply this diff to remove the dead code:
- // &MenuItem::with_id( - // app, - // TrayItem::TakeScreenshot, - // "Take Screenshot", - // true, - // None::<&str>, - // )?, &MenuItem::with_id(apps/desktop/src-tauri/src/permissions.rs (1)
74-75: Remove redundantcfgattribute.Line 74's
#[cfg(target_os = "macos")]is redundant since it's already inside a macOS-only block that starts at line 67.Apply this diff:
OSPermission::ScreenRecording => { - #[cfg(target_os = "macos")] scap_screencapturekit::request_permission(); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.lockpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
Cargo.toml(0 hunks)apps/desktop/src-tauri/Cargo.toml(0 hunks)apps/desktop/src-tauri/src/audio.rs(0 hunks)apps/desktop/src-tauri/src/lib.rs(0 hunks)apps/desktop/src-tauri/src/permissions.rs(2 hunks)apps/desktop/src-tauri/src/tray.rs(1 hunks)apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx(0 hunks)apps/desktop/src/utils/tauri.ts(3 hunks)crates/scap-screencapturekit/src/lib.rs(1 hunks)crates/scap-screencapturekit/src/permission.rs(1 hunks)
💤 Files with no reviewable changes (5)
- apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx
- Cargo.toml
- apps/desktop/src-tauri/Cargo.toml
- apps/desktop/src-tauri/src/audio.rs
- apps/desktop/src-tauri/src/lib.rs
🧰 Additional context used
📓 Path-based instructions (5)
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Format Rust code usingrustfmtand ensure all Rust code passes workspace-level clippy lints.
Rust modules should be named with snake_case, and crate directories should be in kebab-case.
Files:
apps/desktop/src-tauri/src/permissions.rscrates/scap-screencapturekit/src/lib.rscrates/scap-screencapturekit/src/permission.rsapps/desktop/src-tauri/src/tray.rs
crates/*/src/**/*
📄 CodeRabbit inference engine (AGENTS.md)
Rust crates should place tests within the
src/and/or a siblingtests/directory for each crate insidecrates/*.
Files:
crates/scap-screencapturekit/src/lib.rscrates/scap-screencapturekit/src/permission.rs
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by runningpnpm format.
Files:
apps/desktop/src/utils/tauri.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g.,user-menu.tsx).
Use PascalCase for React/Solid components.
Files:
apps/desktop/src/utils/tauri.ts
**/tauri.ts
📄 CodeRabbit inference engine (AGENTS.md)
Do not edit auto-generated files named
tauri.ts.
Files:
apps/desktop/src/utils/tauri.ts
🧠 Learnings (2)
📚 Learning: 2025-09-22T14:19:56.010Z
Learnt from: CR
Repo: CapSoftware/Cap PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-22T14:19:56.010Z
Learning: On macOS, desktop app permissions (screen/mic) apply to the terminal running `pnpm dev:desktop`.
Applied to files:
apps/desktop/src-tauri/src/permissions.rs
📚 Learning: 2025-09-22T14:19:56.010Z
Learnt from: CR
Repo: CapSoftware/Cap PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-22T14:19:56.010Z
Learning: Applies to **/tauri.ts : Do not edit auto-generated files named `tauri.ts`.
Applied to files:
apps/desktop/src/utils/tauri.ts
🧬 Code graph analysis (4)
apps/desktop/src-tauri/src/permissions.rs (1)
crates/scap-screencapturekit/src/permission.rs (2)
request_permission(1-3)has_permission(5-7)
crates/scap-screencapturekit/src/lib.rs (2)
crates/scap-screencapturekit/src/permission.rs (2)
has_permission(5-7)request_permission(1-3)apps/desktop/src-tauri/src/permissions.rs (1)
request_permission(66-112)
crates/scap-screencapturekit/src/permission.rs (1)
apps/desktop/src-tauri/src/permissions.rs (1)
request_permission(66-112)
apps/desktop/src-tauri/src/tray.rs (1)
apps/desktop/src/utils/tauri.ts (3)
RecordingStarted(448-448)RecordingStopped(449-449)RequestOpenSettings(454-454)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Clippy
- GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Analyze (rust)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
apps/desktop/src/utils/tauri.ts (1)
1-493: Auto-generated file - no manual edits required.This file is auto-generated by tauri-specta (as noted in line 2). The type updates and command removal reflect changes in the Rust backend and will be regenerated automatically when the backend changes.
Based on learnings.
apps/desktop/src-tauri/src/tray.rs (3)
2-2: LGTM: Import cleanup aligns with screenshot removal.The removal of
RequestNewScreenshotfrom imports is consistent with the elimination of the screenshot functionality from the tray menu.
19-56: LGTM: TakeScreenshot completely removed from tray items.The
TrayItemenum and its conversions have been properly updated to remove allTakeScreenshotreferences. The implementation is clean and consistent.
58-202: LGTM: Tray menu creation and event handling properly updated.The
create_trayfunction correctly excludes any screenshot-related menu items and event handlers. The remaining tray functionality (recordings, settings, logs, quit) is intact and properly implemented.apps/desktop/src-tauri/src/permissions.rs (1)
167-167: LGTM!The migration from
scap::has_permission()toscap_screencapturekit::has_permission()is correct.crates/scap-screencapturekit/src/lib.rs (1)
5-5: LGTM!The module declaration and re-exports follow standard Rust patterns and provide a clean public API for permission handling.
Also applies to: 9-9
Summary by CodeRabbit
Removed Features
Backend Updates