Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

refactor: use core-graphics-helmer-fork instead of scap (#1727)

Divanshu Grover4ee0e8db7710
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index b7b100571..ff932d0eb 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -68,16 +68,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "annotate-snippets"
-version = "0.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ccaf7e9dfbb6ab22c82e473cd1a8a7bd313c19a5b7e40970f3d89ef5a5c9e81e"
-dependencies = [
- "unicode-width",
- "yansi-term",
-]
-
[[package]]
name = "anstream"
version = "0.6.14"
@@ -572,27 +562,6 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
-[[package]]
-name = "bindgen"
-version = "0.69.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
-dependencies = [
- "annotate-snippets",
- "bitflags 2.8.0",
- "cexpr",
- "clang-sys",
- "itertools",
- "lazy_static",
- "lazycell",
- "proc-macro2",
- "quote",
- "regex",
- "rustc-hash",
- "shlex",
- "syn 2.0.90",
-]
-
[[package]]
name = "bit_field"
version = "0.10.2"
@@ -800,15 +769,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
-[[package]]
-name = "cexpr"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
-dependencies = [
- "nom",
-]
-
[[package]]
name = "cfb"
version = "0.7.3"
@@ -869,17 +829,6 @@ dependencies = [
"windows-targets 0.52.6",
]
-[[package]]
-name = "clang-sys"
-version = "1.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
-dependencies = [
- "glob",
- "libc",
- "libloading 0.8.6",
-]
-
[[package]]
name = "clap"
version = "4.5.23"
@@ -887,7 +836,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84"
dependencies = [
"clap_builder",
- "clap_derive",
]
[[package]]
@@ -902,18 +850,6 @@ dependencies = [
"strsim",
]
-[[package]]
-name = "clap_derive"
-version = "4.5.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab"
-dependencies = [
- "heck 0.5.0",
- "proc-macro2",
- "quote",
- "syn 2.0.90",
-]
-
[[package]]
name = "clap_lex"
version = "0.7.4"
@@ -1052,15 +988,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
-[[package]]
-name = "convert_case"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca"
-dependencies = [
- "unicode-segmentation",
-]
-
[[package]]
name = "cookie"
version = "0.18.1"
@@ -1072,15 +999,6 @@ dependencies = [
"version_check",
]
-[[package]]
-name = "cookie-factory"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2"
-dependencies = [
- "futures",
-]
-
[[package]]
name = "cookie_store"
version = "0.21.1"
@@ -1368,16 +1286,6 @@ dependencies = [
"syn 2.0.90",
]
-[[package]]
-name = "ctrlc"
-version = "3.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90eeab0aa92f3f9b4e87f258c72b139c207d251f9cbc1080a0086b86a8870dd3"
-dependencies = [
- "nix 0.29.0",
- "windows-sys 0.59.0",
-]
-
[[package]]
name = "dark-light"
version = "2.0.0"
@@ -1433,17 +1341,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a"
-[[package]]
-name = "dbus"
-version = "0.9.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b"
-dependencies = [
- "libc",
- "libdbus-sys",
- "winapi",
-]
-
[[package]]
name = "debugid"
version = "0.8.0"
@@ -1492,7 +1389,7 @@ version = "0.99.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce"
dependencies = [
- "convert_case 0.4.0",
+ "convert_case",
"proc-macro2",
"quote",
"rustc_version",
@@ -3215,12 +3112,6 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
-[[package]]
-name = "lazycell"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
-
[[package]]
name = "lebe"
version = "0.5.2"
@@ -3257,15 +3148,6 @@ version = "0.2.169"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
-[[package]]
-name = "libdbus-sys"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72"
-dependencies = [
- "pkg-config",
-]
-
[[package]]
name = "libfuzzer-sys"
version = "0.4.8"
@@ -3306,34 +3188,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "libspa"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65f3a4b81b2a2d8c7f300643676202debd1b7c929dbf5c9bb89402ea11d19810"
-dependencies = [
- "bitflags 2.8.0",
- "cc",
- "convert_case 0.6.0",
- "cookie-factory",
- "libc",
- "libspa-sys",
- "nix 0.27.1",
- "nom",
- "system-deps",
-]
-
-[[package]]
-name = "libspa-sys"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf0d9716420364790e85cbb9d3ac2c950bde16a7dd36f3209b7dfdfc4a24d01f"
-dependencies = [
- "bindgen",
- "cc",
- "system-deps",
-]
-
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
@@ -4580,34 +4434,6 @@ dependencies = [
"futures-io",
]
-[[package]]
-name = "pipewire"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08e645ba5c45109106d56610b3ee60eb13a6f2beb8b74f8dc8186cf261788dda"
-dependencies = [
- "anyhow",
- "bitflags 2.8.0",
- "libc",
- "libspa",
- "libspa-sys",
- "nix 0.27.1",
- "once_cell",
- "pipewire-sys",
- "thiserror 1.0.69",
-]
-
-[[package]]
-name = "pipewire-sys"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "849e188f90b1dda88fe2bfe1ad31fe5f158af2c98f80fb5d13726c44f3f01112"
-dependencies = [
- "bindgen",
- "libspa-sys",
- "system-deps",
-]
-
[[package]]
name = "pkg-config"
version = "0.3.30"
@@ -5333,25 +5159,6 @@ dependencies = [
"winapi-util",
]
-[[package]]
-name = "scap"
-version = "0.0.8"
-source = "git+https://github.com/CapSoftware/scap?rev=92cabc5#92cabc5b4628a238b626a085b04cc0be0746cd1e"
-dependencies = [
- "cocoa 0.25.0",
- "core-graphics-helmer-fork",
- "dbus",
- "objc",
- "pipewire",
- "rand 0.8.5",
- "screencapturekit",
- "screencapturekit-sys",
- "sysinfo 0.30.13",
- "tao-core-video-sys",
- "windows 0.58.0",
- "windows-capture",
-]
-
[[package]]
name = "schannel"
version = "0.1.23"
@@ -5400,29 +5207,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
-[[package]]
-name = "screencapturekit"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a5eeeb57ac94960cfe5ff4c402be6585ae4c8d29a2cf41b276048c2e849d64e"
-dependencies = [
- "screencapturekit-sys",
-]
-
-[[package]]
-name = "screencapturekit-sys"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22411b57f7d49e7fe08025198813ee6fd65e1ee5eff4ebc7880c12c82bde4c60"
-dependencies = [
- "block",
- "dispatch",
- "objc",
- "objc-foundation",
- "objc_id",
- "once_cell",
-]
-
[[package]]
name = "screenpipe-app"
version = "0.44.0"
@@ -5434,6 +5218,7 @@ dependencies = [
"chrono",
"cocoa 0.26.0",
"core-foundation 0.10.0",
+ "core-graphics-helmer-fork",
"dark-light",
"dirs 5.0.1",
"fix-path-env",
@@ -5449,11 +5234,10 @@ dependencies = [
"objc",
"once_cell",
"reqwest",
- "scap",
"serde",
"serde_derive",
"serde_json",
- "sysinfo 0.29.0",
+ "sysinfo",
"tauri",
"tauri-build",
"tauri-nspanel",
@@ -5872,12 +5656,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "shlex"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
-
[[package]]
name = "signal-hook-registry"
version = "1.4.2"
@@ -6144,21 +5922,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "sysinfo"
-version = "0.30.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3"
-dependencies = [
- "cfg-if 1.0.0",
- "core-foundation-sys 0.8.7",
- "libc",
- "ntapi",
- "once_cell",
- "rayon",
- "windows 0.52.0",
-]
-
[[package]]
name = "system-configuration"
version = "0.6.1"
@@ -6232,18 +5995,6 @@ dependencies = [
"x11-dl",
]
-[[package]]
-name = "tao-core-video-sys"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271450eb289cb4d8d0720c6ce70c72c8c858c93dd61fc625881616752e6b98f6"
-dependencies = [
- "cfg-if 1.0.0",
- "core-foundation-sys 0.8.7",
- "libc",
- "objc",
-]
-
[[package]]
name = "tao-macros"
version = "0.1.2"
@@ -7391,12 +7142,6 @@ version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202"
-[[package]]
-name = "unicode-width"
-version = "0.1.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
-
[[package]]
name = "untrusted"
version = "0.9.0"
@@ -7904,20 +7649,6 @@ dependencies = [
"windows-targets 0.52.6",
]
-[[package]]
-name = "windows-capture"
-version = "1.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6001b777f61cafce437201de46a019ed7f4afed3b669f02e5ce4e0759164cb3e"
-dependencies = [
- "clap",
- "ctrlc",
- "parking_lot",
- "rayon",
- "thiserror 1.0.69",
- "windows 0.58.0",
-]
-
[[package]]
name = "windows-core"
version = "0.52.0"
@@ -8425,15 +8156,6 @@ dependencies = [
"windows-sys 0.52.0",
]
-[[package]]
-name = "yansi-term"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1"
-dependencies = [
- "winapi",
-]
-
[[package]]
name = "yoke"
version = "0.7.5"
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 268a6ed73..d2b3ade09 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -101,7 +101,7 @@ cocoa = "0.26.0"
objc = "0.2.7"
base64 = "0.22.1"
# bunch of hack for permissions
-scap = { git = "https://github.com/CapSoftware/scap", rev = "92cabc5" }
+core-graphics-helmer-fork = "0.24.0"
nokhwa-bindings-macos = { git = "https://github.com/CapSoftware/nokhwa", rev = "0d3d1f30a78b" }
tauri-nspanel = { git = "https://github.com/ahkohd/tauri-nspanel", branch = "v2" }
diff --git a/screenpipe-app-tauri/src-tauri/src/permissions.rs b/screenpipe-app-tauri/src-tauri/src/permissions.rs
index 7316eb8f5..3aec29091 100644
--- a/screenpipe-app-tauri/src-tauri/src/permissions.rs
+++ b/screenpipe-app-tauri/src-tauri/src/permissions.rs
@@ -50,7 +50,8 @@ pub async fn request_permission(permission: OSPermission) {
use nokhwa_bindings_macos::AVMediaType;
match permission {
OSPermission::ScreenRecording => {
- scap::request_permission();
+ use core_graphics_helmer_fork::access::ScreenCaptureAccess;
+ ScreenCaptureAccess.request();
}
OSPermission::Microphone => request_av_permission(AVMediaType::Audio),
OSPermission::Accessibility => request_accessibility_permission(),
@@ -127,7 +128,8 @@ pub fn do_permissions_check(initial_check: bool) -> OSPermissionsCheck {
OSPermissionsCheck {
screen_recording: {
- let result = scap::has_permission();
+ use core_graphics_helmer_fork::access::ScreenCaptureAccess;
+ let result = ScreenCaptureAccess.preflight();
match (result, initial_check) {
(true, _) => OSPermissionStatus::Granted,
(false, true) => OSPermissionStatus::Empty,