-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: deeplinks support + Raycast extension #1734
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
base: main
Are you sure you want to change the base?
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,5 @@ | ||
| node_modules | ||
| out | ||
| dist | ||
| *.log | ||
| .DS_Store |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| { | ||
| "$schema": "https://www.raycast.com/schemas/extension.json", | ||
| "name": "cap", | ||
| "title": "Cap", | ||
| "description": "Control Cap recording via deeplinks", | ||
| "icon": "command-icon.png", | ||
| "author": "cap", | ||
| "categories": [ | ||
| "Productivity" | ||
| ], | ||
| "license": "MIT", | ||
| "commands": [ | ||
| { | ||
| "name": "start-recording", | ||
| "title": "Start Recording", | ||
| "description": "Start a Cap recording", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "stop-recording", | ||
| "title": "Stop Recording", | ||
| "description": "Stop the current Cap recording", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "pause-recording", | ||
| "title": "Pause Recording", | ||
| "description": "Pause the current Cap recording", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "resume-recording", | ||
| "title": "Resume Recording", | ||
| "description": "Resume the current Cap recording", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "switch-microphone", | ||
| "title": "Switch Microphone", | ||
| "description": "Switch the active microphone in Cap", | ||
| "mode": "no-view", | ||
| "arguments": [ | ||
| { | ||
| "name": "mic", | ||
| "placeholder": "Microphone Name", | ||
| "type": "text", | ||
| "required": true | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "switch-camera", | ||
| "title": "Switch Camera", | ||
| "description": "Switch the active camera in Cap", | ||
| "mode": "no-view", | ||
| "arguments": [ | ||
| { | ||
| "name": "camera", | ||
| "placeholder": "Camera Name", | ||
| "type": "text", | ||
| "required": true | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "dependencies": { | ||
| "@raycast/api": "^1.83.1" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "20.8.10", | ||
| "@types/react": "18.2.27", | ||
| "typescript": "^5.2.2" | ||
| }, | ||
| "scripts": { | ||
| "build": "ray build -e dist", | ||
| "dev": "ray develop", | ||
| "lint": "ray lint", | ||
| "fix-lint": "ray fix-lint" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { open } from "@raycast/api"; | ||
|
|
||
| export default async function Command() { | ||
| const value = JSON.stringify({ PauseRecording: {} }); | ||
| await open(`cap://action?value=${encodeURIComponent(value)}`); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { open } from "@raycast/api"; | ||
|
|
||
| export default async function Command() { | ||
| const value = JSON.stringify({ ResumeRecording: {} }); | ||
| await open(`cap://action?value=${encodeURIComponent(value)}`); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| import { open } from "@raycast/api"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| export default async function Command() { | ||||||||||||||||||||||||||||||||||||||||||||||||
| const value = JSON.stringify({ | ||||||||||||||||||||||||||||||||||||||||||||||||
| StartRecording: { | ||||||||||||||||||||||||||||||||||||||||||||||||
| capture_mode: { Screen: "" }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| camera: null, | ||||||||||||||||||||||||||||||||||||||||||||||||
| mic_label: null, | ||||||||||||||||||||||||||||||||||||||||||||||||
| capture_system_audio: false, | ||||||||||||||||||||||||||||||||||||||||||||||||
| mode: "Studio", | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||
| await open(`cap://action?value=${encodeURIComponent(value)}`); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+13
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.
Beyond the outer variant name (
All three mismatches together mean this command will always fail to parse.
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: extensions/raycast/src/start-recording.tsx
Line: 3-13
Comment:
**Nested serde renames also use the wrong case**
Beyond the outer variant name (`StartRecording` → `start_recording`), two inner types have their own `rename_all` rules:
- `CaptureMode` has `rename_all = "snake_case"` → `Screen` must be `screen`
- `RecordingMode` has `rename_all = "camelCase"` → `Studio` must be `studio`
All three mismatches together mean this command will always fail to parse.
```suggestion
export default async function Command() {
const value = JSON.stringify({
start_recording: {
capture_mode: { screen: "" },
camera: null,
mic_label: null,
capture_system_audio: false,
mode: "studio",
},
});
await open(`cap://action?value=${encodeURIComponent(value)}`);
}
```
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,6 @@ | ||||||
| import { open } from "@raycast/api"; | ||||||
|
|
||||||
| export default async function Command() { | ||||||
| const value = JSON.stringify({ StopRecording: {} }); | ||||||
|
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.
Same problem in
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: extensions/raycast/src/stop-recording.tsx
Line: 4
Comment:
**Wrong serde variant names across all Raycast commands**
`DeepLinkAction` is declared with `#[serde(rename_all = "snake_case")]`, so every variant name is serialised as `snake_case` in JSON. All six Raycast commands use the original `PascalCase` names, which serde will never match, so every deeplink invocation silently fails with a parse error.
Same problem in `pause-recording.tsx` (`PauseRecording`), `resume-recording.tsx` (`ResumeRecording`), `switch-microphone.tsx` (`SwitchMicrophone`), `switch-camera.tsx` (`SwitchCamera`), and `start-recording.tsx` (`StartRecording`).
```suggestion
const value = JSON.stringify({ stop_recording: {} });
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||
| await open(`cap://action?value=${encodeURIComponent(value)}`); | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||||||||||||||||||||
| import { open } from "@raycast/api"; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| interface Props { | ||||||||||||||||||||||||
| arguments: { | ||||||||||||||||||||||||
| camera: string; | ||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| export default async function Command(props: Props) { | ||||||||||||||||||||||||
| const value = JSON.stringify({ | ||||||||||||||||||||||||
| SwitchCamera: { | ||||||||||||||||||||||||
| camera: props.arguments.camera, | ||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||
| await open(`cap://action?value=${encodeURIComponent(value)}`); | ||||||||||||||||||||||||
|
Comment on lines
+10
to
+15
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 field type is
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: extensions/raycast/src/switch-camera.tsx
Line: 10-15
Comment:
**`camera` must be a `DeviceOrModelID` tagged object, not a bare string**
The Rust field type is `DeviceOrModelID`, an enum serialised with serde's default external-tag format. Passing a plain string like `"My Camera"` will fail to deserialise. The correct payload for a device ID is `{ DeviceID: "..." }` (or `{ ModelID: "..." }` for model IDs).
```suggestion
const value = JSON.stringify({
switch_camera: {
camera: { DeviceID: props.arguments.camera },
},
});
```
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,16 @@ | ||
| import { open } from "@raycast/api"; | ||
|
|
||
| interface Props { | ||
| arguments: { | ||
| mic: string; | ||
| }; | ||
| } | ||
|
|
||
| export default async function Command(props: Props) { | ||
| const value = JSON.stringify({ | ||
| SwitchMicrophone: { | ||
| mic_label: props.arguments.mic, | ||
| }, | ||
| }); | ||
| await open(`cap://action?value=${encodeURIComponent(value)}`); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/tsconfig", | ||
| "display": "Node 20", | ||
| "include": ["src/**/*"], | ||
| "compilerOptions": { | ||
| "lib": ["ES2023"], | ||
| "module": "commonjs", | ||
| "target": "ES2022", | ||
| "strict": true, | ||
| "isolatedModules": true, | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "jsx": "react-jsx", | ||
| "resolveJsonModule": true, | ||
| "declaration": true, | ||
| "outDir": "out" | ||
| } | ||
| } |
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.
capture_modeis hard-coded toScreenwith an empty display name (""), andmodeis hard-coded to"Studio". An empty display name causes the Rust handler to searchlist_displays()for a display whosename == "", which will not match any real display and returns an error. Thestart-recordingcommand should either accept arguments for these fields or use a sensible default like the primary display name.Prompt To Fix With AI