-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Extended Deeplinks + Raycast Extension (#1540) #1582
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
divol89
wants to merge
1
commit into
CapSoftware:main
Choose a base branch
from
divol89:fix/deeplinks-raycast
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| # Cap Deeplinks API Documentation | ||
|
|
||
| This document describes the deeplinks API available in the Cap desktop application for integration with external tools like Raycast. | ||
|
|
||
| ## URL Scheme | ||
|
|
||
| All deeplinks use the `cap-desktop://` URL scheme. | ||
|
|
||
| ## Format | ||
|
|
||
| Deeplinks follow this format: | ||
| ``` | ||
| cap-desktop://action?value=<JSON_ENCODED_ACTION> | ||
| ``` | ||
|
|
||
| Where `<JSON_ENCODED_ACTION>` is a JSON object containing: | ||
| - `action`: The action type (snake_case) | ||
| - Additional parameters specific to each action | ||
|
|
||
| ## Available Actions | ||
|
|
||
| ### 1. Start Recording | ||
|
|
||
| Starts a new screen recording. | ||
|
|
||
| **Action:** `start_recording` | ||
|
|
||
| **Parameters:** | ||
| - `capture_mode` (object): Screen or Window selection | ||
| - `Screen`: `{ "Screen": "Screen Name" }` | ||
| - `Window`: `{ "Window": "Window Name" }` | ||
| - `camera` (optional): Camera device ID or model ID | ||
| - `{ "DeviceID": "device-id" }` or `{ "ModelID": "model-id" }` | ||
| - `mic_label` (optional, string): Microphone device name | ||
| - `capture_system_audio` (boolean): Whether to capture system audio | ||
| - `mode` (string): Recording mode - `"studio"`, `"instant"`, or `"screenshot"` | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22start_recording%22%2C%22capture_mode%22%3A%7B%22Screen%22%3A%22Primary%22%7D%2C%22camera%22%3Anull%2C%22mic_label%22%3Anull%2C%22capture_system_audio%22%3Afalse%2C%22mode%22%3A%22studio%22%7D | ||
| ``` | ||
|
|
||
| ### 2. Stop Recording | ||
|
|
||
| Stops the current recording. | ||
|
|
||
| **Action:** `stop_recording` | ||
|
|
||
| **Parameters:** None | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22stop_recording%22%7D | ||
| ``` | ||
|
|
||
| ### 3. Pause Recording | ||
|
|
||
| Pauses the current recording without stopping it. | ||
|
|
||
| **Action:** `pause_recording` | ||
|
|
||
| **Parameters:** None | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22pause_recording%22%7D | ||
| ``` | ||
|
|
||
| ### 4. Resume Recording | ||
|
|
||
| Resumes a paused recording. | ||
|
|
||
| **Action:** `resume_recording` | ||
|
|
||
| **Parameters:** None | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22resume_recording%22%7D | ||
| ``` | ||
|
|
||
| ### 5. Toggle Pause | ||
|
|
||
| Toggles between pause and resume states. | ||
|
|
||
| **Action:** `toggle_pause_recording` | ||
|
|
||
| **Parameters:** None | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22toggle_pause_recording%22%7D | ||
| ``` | ||
|
|
||
| ### 6. Switch Microphone | ||
|
|
||
| Changes the active microphone input. | ||
|
|
||
| **Action:** `switch_microphone` | ||
|
|
||
| **Parameters:** | ||
| - `mic_label` (string or null): Microphone device name, or `null` to disable microphone | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22switch_microphone%22%2C%22mic_label%22%3A%22Built-in%20Microphone%22%7D | ||
| ``` | ||
|
|
||
| ### 7. Switch Camera | ||
|
|
||
| Changes the active camera input. | ||
|
|
||
| **Action:** `switch_camera` | ||
|
|
||
| **Parameters:** | ||
| - `camera` (object or null): Camera identifier or `null` to disable camera | ||
| - `{ "DeviceID": "device-id" }` or `{ "ModelID": "model-id" }` | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22switch_camera%22%2C%22camera%22%3A%7B%22DeviceID%22%3A%22camera-id%22%7D%7D | ||
| ``` | ||
|
|
||
| ### 8. Open Editor | ||
|
|
||
| Opens a project in the Cap editor. | ||
|
|
||
| **Action:** `open_editor` | ||
|
|
||
| **Parameters:** | ||
| - `project_path` (string): Full path to the .cap project file | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22open_editor%22%2C%22project_path%22%3A%22%2Fpath%2Fto%2Fproject.cap%22%7D | ||
| ``` | ||
|
|
||
| **Note:** On macOS, you can also use `file://` URLs to open .cap files directly. | ||
|
|
||
| ### 9. Open Settings | ||
|
|
||
| Opens the Cap settings window. | ||
|
|
||
| **Action:** `open_settings` | ||
|
|
||
| **Parameters:** | ||
| - `page` (optional, string): Settings page to open | ||
|
|
||
| **Example:** | ||
| ``` | ||
| cap-desktop://action?value=%7B%22action%22%3A%22open_settings%22%2C%22page%22%3A%22general%22%7D | ||
| ``` | ||
|
|
||
| ## Error Handling | ||
|
|
||
| If a deeplink action fails: | ||
| 1. The error is logged to the console | ||
| 2. The user may see a notification from the Cap app | ||
| 3. The action is silently ignored if the app is not running | ||
|
|
||
| ## Requirements | ||
|
|
||
| - Cap desktop app must be installed | ||
| - Cap desktop app should be running (some actions will launch it if not) | ||
| - On macOS, the `cap-desktop` URL scheme is registered automatically during installation | ||
| - On Windows, the URL scheme is registered automatically during installation | ||
|
|
||
| ## Testing Deeplinks | ||
|
|
||
| You can test deeplinks from the terminal: | ||
|
|
||
| ### macOS | ||
| ```bash | ||
| open "cap-desktop://action?value=%7B%22action%22%3A%22start_recording%22%2C%22capture_mode%22%3A%7B%22Screen%22%3A%22Primary%22%7D%2C%22camera%22%3Anull%2C%22mic_label%22%3Anull%2C%22capture_system_audio%22%3Afalse%2C%22mode%22%3A%22studio%22%7D" | ||
| ``` | ||
|
|
||
| ### Windows | ||
| ```powershell | ||
| start "cap-desktop://action?value=%7B%22action%22%3A%22start_recording%22%2C%22capture_mode%22%3A%7B%22Screen%22%3A%22Primary%22%7D%2C%22camera%22%3Anull%2C%22mic_label%22%3Anull%2C%22capture_system_audio%22%3Afalse%2C%22mode%22%3A%22studio%22%7D" | ||
| ``` | ||
|
|
||
| ### Linux | ||
| ```bash | ||
| xdg-open "cap-desktop://action?value=%7B%22action%22%3A%22start_recording%22%2C%22capture_mode%22%3A%7B%22Screen%22%3A%22Primary%22%7D%2C%22camera%22%3Anull%2C%22mic_label%22%3Anull%2C%22capture_system_audio%22%3Afalse%2C%22mode%22%3A%22studio%22%7D" | ||
| ``` | ||
|
|
||
| ## Integration Examples | ||
|
|
||
| ### Raycast Extension | ||
| See the `extensions/raycast/cap` directory for a complete Raycast extension implementation. | ||
|
|
||
| ### Alfred Workflow | ||
| You can create Alfred workflows using the deeplink URLs with the `open` command on macOS. | ||
|
|
||
| ### Keyboard Shortcuts (Custom) | ||
| Use tools like BetterTouchTool (macOS) or AutoHotkey (Windows) to trigger deeplinks with custom keyboard shortcuts. | ||
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,5 @@ | ||
| node_modules/ | ||
| dist/ | ||
| *.log | ||
| .DS_Store | ||
| *.tgz |
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,16 @@ | ||
| CHANGELOG | ||
|
|
||
| ## [1.0.0] - 2025-02-06 | ||
|
|
||
| ### Added | ||
| - Initial release of Cap Raycast Extension | ||
| - Start Recording command | ||
| - Stop Recording command | ||
| - Pause Recording command | ||
| - Resume Recording command | ||
| - Toggle Pause command | ||
| - Switch Microphone command | ||
| - Switch Camera command | ||
| - Open Settings command | ||
| - Support for Studio and Instant recording modes | ||
| - Preference for system audio capture |
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,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Cap Software, Inc. | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
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,62 @@ | ||
| # Cap Raycast Extension | ||
|
|
||
| Control [Cap](https://cap.so) screen recorder directly from Raycast using deeplinks. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Start Recording** - Begin a new screen recording | ||
| - **Stop Recording** - Stop the current recording | ||
| - **Pause Recording** - Pause the active recording | ||
| - **Resume Recording** - Resume a paused recording | ||
| - **Toggle Pause** - Toggle between pause/resume states | ||
| - **Switch Microphone** - Change the active microphone input | ||
| - **Switch Camera** - Change the active camera input | ||
| - **Open Settings** - Open Cap settings window | ||
|
|
||
| ## Requirements | ||
|
|
||
| - [Cap](https://cap.so) desktop app must be installed | ||
| - Cap desktop app must be running | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Install the Cap desktop app from [cap.so](https://cap.so) | ||
| 2. Install this Raycast extension | ||
| 3. Start using the commands! | ||
|
|
||
| ## Usage | ||
|
|
||
| All commands work through deeplinks to the Cap desktop app. The extension supports the following preferences: | ||
|
|
||
| - **Default Recording Mode**: Choose between "Studio" or "Instant" recording mode | ||
| - **Capture System Audio**: Enable/disable system audio capture by default | ||
|
|
||
| ## Commands Reference | ||
|
|
||
| | Command | Description | | ||
| |---------|-------------| | ||
| | Start Recording | Starts a new recording with configured settings | | ||
| | Stop Recording | Stops the current active recording | | ||
| | Pause Recording | Pauses the recording without stopping it | | ||
| | Resume Recording | Resumes a paused recording | | ||
| | Toggle Pause | Toggles between pause and resume states | | ||
| | Switch Microphone | Opens a list to select a different microphone | | ||
| | Switch Camera | Opens a list to select a different camera | | ||
| | Open Settings | Opens the Cap settings window | | ||
|
|
||
| ## Development | ||
|
|
||
| ```bash | ||
| # Install dependencies | ||
| npm install | ||
|
|
||
| # Build the extension | ||
| npm run build | ||
|
|
||
| # Watch for changes during development | ||
| npm run dev | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| MIT |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Minor but important: the
capture_modeenum is deserialized withsnake_case, so the docs should showscreen/windowkeys (otherwise copy/paste examples won’t work).