-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add deeplink support for recording controls and Raycast extensi… #1545
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
Open
preettrank53
wants to merge
2
commits into
CapSoftware:main
Choose a base branch
from
preettrank53:feat/deeplinks-raycast-extension
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| # Cap Raycast Extension | ||
|
|
||
| Control [Cap](https://cap.so) screen recording directly from Raycast! | ||
|
|
||
| ## Features | ||
|
|
||
| This extension provides quick access to Cap's recording functionality through Raycast commands: | ||
|
|
||
| ### Recording Controls | ||
| - **Start Recording** - Start a new screen or window recording with customizable options | ||
| - **Stop Recording** - Stop the current recording | ||
| - **Pause Recording** - Pause the active recording | ||
| - **Resume Recording** - Resume a paused recording | ||
| - **Toggle Pause** - Toggle between paused and active recording states | ||
|
|
||
| ### Capture | ||
| - **Take Screenshot** - Capture a screenshot of a specific display or window | ||
|
|
||
| ### Hardware Management | ||
| - **Switch Camera** - Change the active camera input or disable camera | ||
| - **Switch Microphone** - Change the active microphone input or mute | ||
|
|
||
| ## Requirements | ||
|
|
||
| - [Cap](https://cap.so) desktop application (v0.3.0 or later) must be installed | ||
| - macOS (Raycast is macOS-only) | ||
| - Cap must be running to respond to commands | ||
|
|
||
| ## Installation | ||
|
|
||
| ### From Raycast Store (Coming Soon) | ||
| 1. Open Raycast | ||
| 2. Search for "Cap" | ||
| 3. Click "Install Extension" | ||
|
|
||
| ### Manual Installation (Development) | ||
| 1. Clone the repository: | ||
| ```bash | ||
| git clone https://github.com/CapSoftware/Cap.git | ||
| cd Cap/apps/raycast-extension | ||
| ``` | ||
|
|
||
| 2. Install dependencies: | ||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| 3. Build the extension: | ||
| ```bash | ||
| npm run dev | ||
| ``` | ||
|
|
||
| 4. The extension will automatically be available in Raycast during development | ||
|
|
||
| ## Usage | ||
|
|
||
| ### Starting a Recording | ||
| 1. Open Raycast (⌘ + Space) | ||
| 2. Type "Start Recording" | ||
| 3. Fill in the form: | ||
| - **Capture Type**: Choose Screen or Window | ||
| - **Target Name**: Enter the display/window name | ||
| - **Recording Mode**: Studio (editable) or Instant (immediately uploaded) | ||
| - **Enable Camera**: Toggle camera on/off | ||
| - **Enable Microphone**: Toggle microphone on/off | ||
| - **Capture System Audio**: Include system audio in recording | ||
| 4. Press Enter to start recording | ||
|
|
||
| ### Finding Display/Window Names | ||
| Use the built-in Cap commands to list available targets: | ||
| - In your terminal, run Cap with `--list-displays` or `--list-windows` flags | ||
| - Or check the Cap UI for display/window names | ||
|
|
||
| ### Quick Actions | ||
| All other commands are instant actions: | ||
| - **Stop Recording**: Simply run the command | ||
| - **Pause/Resume**: Run the respective command while recording | ||
| - **Toggle Pause**: Quick shortcut to toggle pause state | ||
| - **Take Screenshot**: Fill in the target and capture instantly | ||
|
|
||
| ### Hardware Switching | ||
| 1. Run "Switch Camera" or "Switch Microphone" | ||
| 2. Enter the device ID or name | ||
| 3. Toggle enable/disable as needed | ||
| 4. Press Enter to switch | ||
|
|
||
| **Tip**: Use the "List Cameras" and "List Microphones" Cap commands to see available devices | ||
|
|
||
| ## Commands Reference | ||
|
|
||
| | Command | Shortcut | Description | | ||
| |---------|----------|-------------| | ||
| | Start Recording | - | Start a new recording with options | | ||
| | Stop Recording | - | Stop the current recording | | ||
| | Pause Recording | - | Pause the active recording | | ||
| | Resume Recording | - | Resume a paused recording | | ||
| | Toggle Pause | - | Toggle pause state | | ||
| | Take Screenshot | - | Capture a screenshot | | ||
| | Switch Camera | - | Change camera input | | ||
| | Switch Microphone | - | Change microphone input | | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Command Not Working | ||
| - Ensure Cap is running | ||
| - Check that Cap has necessary permissions (Screen Recording, Camera, Microphone) | ||
| - Verify you're running Cap v0.3.0 or later with deeplink support | ||
|
|
||
| ### "Failed to Start Recording" | ||
| - Double-check the display/window name is correct | ||
| - Ensure the target display/window exists and is accessible | ||
| - Check Cap's permissions in System Settings > Privacy & Security | ||
|
|
||
| ### Camera/Microphone Not Switching | ||
| - Verify the device ID/name is correct | ||
| - Check that the device is connected and recognized by your system | ||
| - Ensure Cap has permission to access camera/microphone | ||
|
|
||
| ## Development | ||
|
|
||
| ### Project Structure | ||
| ``` | ||
| src/ | ||
| ├── utils/ | ||
| │ └── deeplink.ts # Deeplink utility functions | ||
| ├── start-recording.tsx # Start recording command | ||
| ├── stop-recording.tsx # Stop recording command | ||
| ├── pause-recording.tsx # Pause command | ||
| ├── resume-recording.tsx # Resume command | ||
| ├── toggle-pause.tsx # Toggle pause command | ||
| ├── take-screenshot.tsx # Screenshot command | ||
| ├── switch-camera.tsx # Camera switching command | ||
| └── switch-microphone.tsx # Microphone switching command | ||
| ``` | ||
|
|
||
| ### Building | ||
| ```bash | ||
| npm run build | ||
| ``` | ||
|
|
||
| ### Linting | ||
| ```bash | ||
| npm run lint | ||
| npm run fix-lint | ||
| ``` | ||
|
|
||
| ## How It Works | ||
|
|
||
| This extension communicates with Cap using the `cap-desktop://` URL scheme. Each command constructs a deeplink URL with JSON-encoded actions and opens it, which Cap intercepts and executes. | ||
|
|
||
| Example deeplink: | ||
| ``` | ||
| cap-desktop://action?value={"pauseRecording":{}} | ||
| ``` | ||
|
|
||
| ## Contributing | ||
|
|
||
| Contributions are welcome! Please: | ||
| 1. Fork the repository | ||
| 2. Create a feature branch | ||
| 3. Make your changes | ||
| 4. Submit a pull request | ||
|
|
||
| ## License | ||
|
|
||
| MIT License - see LICENSE file for details | ||
|
|
||
| ## Links | ||
|
|
||
| - [Cap Website](https://cap.so) | ||
| - [Cap GitHub](https://github.com/CapSoftware/Cap) | ||
| - [Report Issues](https://github.com/CapSoftware/Cap/issues) | ||
| - [Raycast](https://raycast.com) | ||
|
|
||
| ## Credits | ||
|
|
||
| Created for the Cap deeplinks bounty (#1540) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| { | ||
| "$schema": "https://www.raycast.com/schemas/extension.json", | ||
| "name": "cap", | ||
| "title": "Cap", | ||
| "description": "Control Cap screen recording from Raycast", | ||
| "icon": "icon.png", | ||
| "author": "cap", | ||
| "license": "MIT", | ||
| "commands": [ | ||
| { | ||
| "name": "start-recording", | ||
| "title": "Start Recording", | ||
| "description": "Start a new screen recording", | ||
| "mode": "view" | ||
| }, | ||
| { | ||
| "name": "stop-recording", | ||
| "title": "Stop Recording", | ||
| "description": "Stop the current recording", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "pause-recording", | ||
| "title": "Pause Recording", | ||
| "description": "Pause the current recording", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "resume-recording", | ||
| "title": "Resume Recording", | ||
| "description": "Resume the paused recording", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "toggle-pause", | ||
| "title": "Toggle Pause", | ||
| "description": "Toggle recording pause state", | ||
| "mode": "no-view" | ||
| }, | ||
| { | ||
| "name": "take-screenshot", | ||
| "title": "Take Screenshot", | ||
| "description": "Capture a screenshot", | ||
| "mode": "view" | ||
| }, | ||
| { | ||
| "name": "switch-camera", | ||
| "title": "Switch Camera", | ||
| "description": "Change camera input", | ||
| "mode": "view" | ||
| }, | ||
| { | ||
| "name": "switch-microphone", | ||
| "title": "Switch Microphone", | ||
| "description": "Change microphone input", | ||
| "mode": "view" | ||
| } | ||
| ], | ||
| "dependencies": { | ||
| "@raycast/api": "^1.83.2", | ||
| "@raycast/utils": "^1.19.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@raycast/eslint-config": "^1.0.11", | ||
| "@types/node": "^20.16.5", | ||
| "@types/react": "^18.3.3", | ||
| "eslint": "^8.57.0", | ||
| "prettier": "^3.3.3", | ||
| "typescript": "^5.5.4" | ||
| }, | ||
| "scripts": { | ||
| "build": "ray build -e dist", | ||
| "dev": "ray develop", | ||
| "fix-lint": "ray lint --fix", | ||
| "lint": "ray lint", | ||
| "publish": "npx @raycast/api@latest publish" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { showToast, Toast } from "@raycast/api"; | ||
| import * as deeplink from "./utils/deeplink"; | ||
|
|
||
| export default async function Command() { | ||
| try { | ||
| await deeplink.pauseRecording(); | ||
| await showToast({ | ||
| style: Toast.Style.Success, | ||
| title: "Recording Paused", | ||
| message: "Cap recording has been paused", | ||
| }); | ||
| } catch (error) { | ||
| await showToast({ | ||
| style: Toast.Style.Failure, | ||
| title: "Failed to Pause Recording", | ||
| message: error instanceof Error ? error.message : "Unknown error occurred", | ||
| }); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
crate::set_camera_inputandcrate::set_mic_inputfunctions inlib.rsare notpuborpub(crate), so this will fail to compile.Check
apps/desktop/src-tauri/src/lib.rs:385andapps/desktop/src-tauri/src/lib.rs:471- both functions needpub(crate)visibility to be accessible from this module.Prompt To Fix With AI