Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: New disable automatic link opening setting

Richie McIlroyf9206fc7eb02
diff --git a/apps/desktop/src-tauri/src/general_settings.rs b/apps/desktop/src-tauri/src/general_settings.rs
index f058cd1be..986b239c0 100644
--- a/apps/desktop/src-tauri/src/general_settings.rs
+++ b/apps/desktop/src-tauri/src/general_settings.rs
@@ -17,6 +17,8 @@ pub struct GeneralSettingsStore {
pub auto_create_shareable_link: bool,
#[serde(default = "default_enable_notifications")]
pub enable_notifications: bool,
+ #[serde(default)]
+ pub disable_auto_open_links: bool,
}
fn default_enable_notifications() -> bool {
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rs
index c8b4c9e65..43ea2036e 100644
--- a/apps/desktop/src-tauri/src/lib.rs
+++ b/apps/desktop/src-tauri/src/lib.rs
@@ -2265,6 +2265,13 @@ async fn check_upgraded_and_update(app: AppHandle) -> Result<bool, String> {
#[tauri::command]
#[specta::specta]
fn open_external_link(app: tauri::AppHandle, url: String) -> Result<(), String> {
+ // Check settings first
+ if let Ok(Some(settings)) = GeneralSettingsStore::get(&app) {
+ if settings.disable_auto_open_links {
+ return Ok(());
+ }
+ }
+
app.shell()
.open(&url, None)
.map_err(|e| format!("Failed to open URL: {}", e))?;
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
index 2b5767a83..ccbfe9193 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/general.tsx
@@ -39,6 +39,12 @@ const settingsList = [
"Show system notifications for events like copying to clipboard, saving files, and more. You may need to manually allow Cap access via your system's notification settings.",
requiresPermission: true,
},
+ {
+ key: "disable_auto_open_links",
+ label: "Disable automatic link opening",
+ description:
+ "When enabled, Cap will not automatically open links in your browser (e.g. after creating a shareable link).",
+ },
];
export default function GeneralSettings() {