diff --git a/BetterCapture/BetterCaptureApp.swift b/BetterCapture/BetterCaptureApp.swift
index c2826a3..1d2cc1c 100644
--- a/BetterCapture/BetterCaptureApp.swift
+++ b/BetterCapture/BetterCaptureApp.swift
@@ -5,6 +5,7 @@
// Created by Joshua Sattler on 29.01.26.
//
+import AppKit
import KeyboardShortcuts
import SwiftUI
@@ -21,6 +22,9 @@ struct BetterCaptureApp: App {
await viewModel.requestPermissionsOnLaunch()
registerKeyboardShortcuts()
}
+ .onOpenURL { url in
+ handleURL(url)
+ }
} label: {
MenuBarLabel(viewModel: viewModel)
}
@@ -32,6 +36,41 @@ struct BetterCaptureApp: App {
}
}
+ // MARK: - URL Scheme
+
+ private func handleURL(_ url: URL) {
+ guard url.scheme == "bettercapture" else { return }
+
+ switch url.host {
+ case "toggle":
+ Task { @MainActor in
+ if viewModel.isRecording {
+ await viewModel.stopRecording()
+ } else {
+ switch ContentSelectionMode.current {
+ case .pickContent:
+ viewModel.presentPicker()
+ case .selectArea:
+ await viewModel.presentAreaSelection()
+ }
+ }
+ }
+ case "open-recordings":
+ Task { @MainActor in
+ let settings = viewModel.settings
+ let didStart = settings.startAccessingOutputDirectory()
+ defer {
+ if didStart {
+ settings.stopAccessingOutputDirectory()
+ }
+ }
+ NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: settings.outputDirectory.path)
+ }
+ default:
+ break
+ }
+ }
+
// MARK: - Keyboard Shortcuts
private func registerKeyboardShortcuts() {
diff --git a/BetterCapture/Info.plist b/BetterCapture/Info.plist
index aaff686..a3edc32 100644
--- a/BetterCapture/Info.plist
+++ b/BetterCapture/Info.plist
@@ -16,5 +16,16 @@
SPARKLE_PUBLIC_KEY
SUEnableInstallerLauncherService
+ CFBundleURLTypes
+
+
+ CFBundleURLName
+ com.sattlerjoshua.BetterCapture
+ CFBundleURLSchemes
+
+ bettercapture
+
+
+
diff --git a/README.md b/README.md
index 56b091f..d16084f 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,21 @@ Download the latest release from [GitHub Releases](https://github.com/jsattler/B
**Requirements**: macOS 15.2 (Sequoia) or later
+## Automation
+
+BetterCapture supports a custom URL scheme for external tools (Raycast, Shortcuts, Alfred):
+
+| URL | Action |
+|---|---|
+| `bettercapture://toggle` | Stop recording if active; otherwise open content selection (Pick Content or Select Area) before recording |
+| `bettercapture://open-recordings` | Open the output folder in Finder |
+
+Example:
+
+```bash
+open "bettercapture://toggle"
+```
+
## Contributing
We welcome contributions of all kinds! Please see our [Contributing Guidelines](CONTRIBUTING.md) for more details on how to get involved.