-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: Add Deeplinks for recording controls and Raycast Extension #1824
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| { | ||
| "name": "cap-raycast-extension", | ||
| "title": "Cap", | ||
| "description": "Control Cap recording and settings via Raycast.", | ||
| "icon": "command-icon.png", | ||
| "author": "Cap Software", | ||
| "categories": [ | ||
| "Productivity" | ||
| ], | ||
| "license": "MIT", | ||
| "commands": [ | ||
| { | ||
| "name": "start-recording", | ||
| "title": "Start Recording", | ||
| "description": "Start a new recording in Cap.", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "stop-recording", | ||
| "title": "Stop Recording", | ||
| "description": "Stop the current recording in Cap.", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "pause-recording", | ||
| "title": "Pause Recording", | ||
| "description": "Pause the current recording in Cap.", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "resume-recording", | ||
| "title": "Resume Recording", | ||
| "description": "Resume the current recording in Cap.", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "switch-mic", | ||
| "title": "Switch Microphone", | ||
| "description": "Switch to a specific microphone by name.", | ||
| "mode": "no-view", | ||
| "arguments": [ | ||
| { | ||
| "name": "mic_label", | ||
| "placeholder": "Microphone Name", | ||
| "type": "text", | ||
| "required": true | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "switch-camera", | ||
| "title": "Switch Camera", | ||
| "description": "Switch to a specific camera by ID.", | ||
| "mode": "no-view", | ||
| "arguments": [ | ||
| { | ||
| "name": "camera_id", | ||
| "placeholder": "Camera ID (e.g. from continuity camera)", | ||
| "type": "text", | ||
| "required": true | ||
| }, | ||
| { | ||
| "name": "type", | ||
| "placeholder": "ID Type (device or model)", | ||
| "type": "text", | ||
| "required": false | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "dependencies": { | ||
| "@raycast/api": "^1.72.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@raycast/utils": "^1.14.2", | ||
| "@types/node": "20.8.10", | ||
| "@types/react": "18.2.27", | ||
| "typescript": "^5.2.2" | ||
| }, | ||
| "scripts": { | ||
| "build": "ray build -e dist", | ||
| "dev": "ray develop", | ||
| "fix-lint": "ray lint --fix", | ||
| "lint": "ray lint", | ||
| "publish": "ray publish" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { executeCapAction } from "./utils"; | ||
|
|
||
| export default async function Command() { | ||
| await executeCapAction("pause_recording"); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { executeCapAction } from "./utils"; | ||
|
|
||
| export default async function Command() { | ||
| await executeCapAction("resume_recording"); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { executeCapAction } from "./utils"; | ||
|
|
||
| export default async function Command() { | ||
| await executeCapAction("start_default_recording"); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { executeCapAction } from "./utils"; | ||
|
|
||
| export default async function Command() { | ||
| await executeCapAction("stop_recording"); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { executeCapAction } from "./utils"; | ||
|
|
||
| export default async function Command(props: { arguments: { camera_id: string; type?: string } }) { | ||
| const isModel = props.arguments.type?.toLowerCase() === "model"; | ||
| await executeCapAction({ | ||
| switch_camera: { | ||
| camera_id: isModel | ||
| ? { ModelID: props.arguments.camera_id } | ||
| : { DeviceID: props.arguments.camera_id }, | ||
| }, | ||
| }); | ||
|
Comment on lines
+5
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Rust enum Prompt To Fix With AIThis is a comment left during a code review.
Path: apps/raycast-extension/src/switch-camera.ts
Line: 4-8
Comment:
**`DeviceID` hardcoded; `ModelID` cameras are unreachable**
The Rust enum `DeviceOrModelID` has two variants: `DeviceID` and `ModelID`. The Raycast command always wraps the user-supplied string as `{ DeviceID: ... }`, so any camera that is identified by a model ID (common for virtual or continuity cameras) cannot be switched to via this command. Consider either accepting the variant as a second argument or documenting that only physical device IDs are supported.
How can I resolve this? If you propose a fix, please make it concise. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { executeCapAction } from "./utils"; | ||
|
|
||
| export default async function Command(props: { arguments: { mic_label: string } }) { | ||
| await executeCapAction({ | ||
| switch_mic: { | ||
| mic_label: props.arguments.mic_label, | ||
| }, | ||
| }); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { open } from "@raycast/api"; | ||
|
|
||
| type CapAction = | ||
| | string | ||
| | { switch_mic: { mic_label: string } } | ||
| | { switch_camera: { camera_id: { DeviceID: string } | { ModelID: string } } }; | ||
|
|
||
| export async function executeCapAction(action: CapAction) { | ||
| const json = JSON.stringify(action); | ||
| const url = `cap://action?value=${encodeURIComponent(json)}`; | ||
| await open(url); | ||
| } |
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.
RecordingEventemissions after pause/resumeThe existing Tauri commands
pause_recordingandresume_recordinginrecording.rs(lines 1516, 1530) emitRecordingEvent::PausedandRecordingEvent::Resumedafter the operation so the UI can update its state. The new deep link handlers callrecording.pause()/recording.resume()but omit those event emissions. As a result, triggering pause or resume via a deep link will leave the UI stuck showing the pre-action recording state (e.g. the pause button will still show as active after pausing).Prompt To Fix With AI