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

feat: support for active Browser URL detection in linux (#1688)

Divanshu Groverb68968e9924c
diff --git a/.github/scripts/check_logs.sh b/.github/scripts/check_logs.sh
index 9a9757edf..3cc6eafd2 100755
--- a/.github/scripts/check_logs.sh
+++ b/.github/scripts/check_logs.sh
@@ -4,7 +4,7 @@ if grep -q "panic" screenpipe_output.log; then
echo "CLI crashed"
exit 1
fi
-if ! grep -q "Server listening on [::]:3030" screenpipe_output.log; then
+if ! grep -a "Server listening on \[::\]:3030" screenpipe_output.log; then
echo "Server did not start correctly"
exit 1
fi
diff --git a/Cargo.lock b/Cargo.lock
index 1c2f1471a..ddb3e4532 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -216,6 +216,132 @@ version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
+[[package]]
+name = "async-broadcast"
+version = "0.7.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
+dependencies = [
+ "event-listener 5.4.0",
+ "event-listener-strategy",
+ "futures-core",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "async-channel"
+version = "2.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
+dependencies = [
+ "concurrent-queue",
+ "event-listener-strategy",
+ "futures-core",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "async-executor"
+version = "1.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec"
+dependencies = [
+ "async-task",
+ "concurrent-queue",
+ "fastrand",
+ "futures-lite",
+ "slab",
+]
+
+[[package]]
+name = "async-fs"
+version = "2.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ebcd09b382f40fcd159c2d695175b2ae620ffa5f3bd6f664131efff4e8b9e04a"
+dependencies = [
+ "async-lock",
+ "blocking",
+ "futures-lite",
+]
+
+[[package]]
+name = "async-io"
+version = "2.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059"
+dependencies = [
+ "async-lock",
+ "cfg-if",
+ "concurrent-queue",
+ "futures-io",
+ "futures-lite",
+ "parking",
+ "polling",
+ "rustix",
+ "slab",
+ "tracing",
+ "windows-sys 0.59.0",
+]
+
+[[package]]
+name = "async-lock"
+version = "3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
+dependencies = [
+ "event-listener 5.4.0",
+ "event-listener-strategy",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "async-process"
+version = "2.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63255f1dc2381611000436537bbedfe83183faa303a5a0edaf191edef06526bb"
+dependencies = [
+ "async-channel",
+ "async-io",
+ "async-lock",
+ "async-signal",
+ "async-task",
+ "blocking",
+ "cfg-if",
+ "event-listener 5.4.0",
+ "futures-lite",
+ "rustix",
+ "tracing",
+]
+
+[[package]]
+name = "async-recursion"
+version = "1.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.100",
+]
+
+[[package]]
+name = "async-signal"
+version = "0.2.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3"
+dependencies = [
+ "async-io",
+ "async-lock",
+ "atomic-waker",
+ "cfg-if",
+ "futures-core",
+ "futures-io",
+ "rustix",
+ "signal-hook-registry",
+ "slab",
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "async-stream"
version = "0.3.6"
@@ -238,6 +364,12 @@ dependencies = [
"syn 2.0.100",
]
+[[package]]
+name = "async-task"
+version = "4.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
+
[[package]]
name = "async-trait"
version = "0.1.88"
@@ -264,6 +396,57 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
+[[package]]
+name = "atspi"
+version = "0.25.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c83247582e7508838caf5f316c00791eee0e15c0bf743e6880585b867e16815c"
+dependencies = [
+ "atspi-common",
+ "atspi-connection",
+ "atspi-proxies",
+ "zbus",
+]
+
+[[package]]
+name = "atspi-common"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33dfc05e7cdf90988a197803bf24f5788f94f7c94a69efa95683e8ffe76cfdfb"
+dependencies = [
+ "enumflags2",
+ "serde",
+ "static_assertions",
+ "zbus",
+ "zbus-lockstep",
+ "zbus-lockstep-macros",
+ "zbus_names",
+ "zvariant",
+]
+
+[[package]]
+name = "atspi-connection"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4193d51303d8332304056ae0004714256b46b6635a5c556109b319c0d3784938"
+dependencies = [
+ "atspi-common",
+ "atspi-proxies",
+ "futures-lite",
+ "zbus",
+]
+
+[[package]]
+name = "atspi-proxies"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2eebcb9e7e76f26d0bcfd6f0295e1cd1e6f33bedbc5698a971db8dc43d7751c"
+dependencies = [
+ "atspi-common",
+ "serde",
+ "zbus",
+]
+
[[package]]
name = "audio"
version = "0.2.0"
@@ -567,6 +750,19 @@ dependencies = [
"objc2 0.6.0",
]
+[[package]]
+name = "blocking"
+version = "1.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea"
+dependencies = [
+ "async-channel",
+ "async-task",
+ "futures-io",
+ "futures-lite",
+ "piper",
+]
+
[[package]]
name = "bollard"
version = "0.16.1"
@@ -1104,6 +1300,15 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "concurrent-queue"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
+dependencies = [
+ "crossbeam-utils",
+]
+
[[package]]
name = "console"
version = "0.15.11"
@@ -1726,6 +1931,12 @@ version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
+[[package]]
+name = "downcast-rs"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
+
[[package]]
name = "dyn-stack"
version = "0.10.0"
@@ -1781,6 +1992,12 @@ dependencies = [
"cfg-if",
]
+[[package]]
+name = "endi"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf"
+
[[package]]
name = "enigo"
version = "0.3.0"
@@ -1812,6 +2029,27 @@ dependencies = [
"syn 2.0.100",
]
+[[package]]
+name = "enumflags2"
+version = "0.7.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba2f4b465f5318854c6f8dd686ede6c0a9dc67d4b1ac241cf0eb51521a309147"
+dependencies = [
+ "enumflags2_derive",
+ "serde",
+]
+
+[[package]]
+name = "enumflags2_derive"
+version = "0.7.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc4caf64a58d7a6d65ab00639b046ff54399a39f5f2554728895ace4b297cd79"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.100",
+]
+
[[package]]
name = "env_filter"
version = "0.1.3"
@@ -1896,6 +2134,27 @@ version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+[[package]]
+name = "event-listener"
+version = "5.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae"
+dependencies = [
+ "concurrent-queue",
+ "parking",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "event-listener-strategy"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2"
+dependencies = [
+ "event-listener 5.4.0",
+ "pin-project-lite",
+]
+
[[package]]
name = "exr"
version = "1.73.0"
@@ -2138,6 +2397,19 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
+[[package]]
+name = "futures-lite"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532"
+dependencies = [
+ "fastrand",
+ "futures-core",
+ "futures-io",
+ "parking",
+ "pin-project-lite",
+]
+
[[package]]
name = "futures-macro"
version = "0.3.31"
@@ -2606,6 +2878,12 @@ version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
+[[package]]
+name = "hermit-abi"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc"
+
[[package]]
name = "hermit-abi"
version = "0.5.0"
@@ -3134,6 +3412,18 @@ dependencies = [
"icu_properties",
]
+[[package]]
+name = "image"
+version = "0.24.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d"
+dependencies = [
+ "bytemuck",
+ "byteorder",
+ "color_quant",
+ "num-traits",
+]
+
[[package]]
name = "image"
version = "0.25.5"
@@ -3163,7 +3453,7 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96cd73af13ae2e7220a1c02fe7d6bb53be50612ba7fabbb5c88e7753645f1f3c"
dependencies = [
- "image",
+ "image 0.25.5",
"itertools 0.12.1",
"rayon",
"thiserror 1.0.69",
@@ -3583,6 +3873,22 @@ dependencies = [
"vcpkg",
]
+[[package]]
+name = "libwayshot"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2efa01ecfd021b1e7db27f21f4e79b35b048081c9cae9d2f898eddc98444d69"
+dependencies = [
+ "image 0.24.9",
+ "log",
+ "memmap2 0.9.5",
+ "nix 0.27.1",
+ "thiserror 1.0.69",
+ "wayland-client",
+ "wayland-protocols",
+ "wayland-protocols-wlr",
+]
+
[[package]]
name = "linux-raw-sys"
version = "0.4.15"
@@ -3760,6 +4066,15 @@ dependencies = [
"stable_deref_trait",
]
+[[package]]
+name = "memoffset"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
+dependencies = [
+ "autocfg",
+]
+
[[package]]
name = "memory-stats"
version = "1.2.0"
@@ -3967,6 +4282,17 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
+[[package]]
+name = "nix"
+version = "0.27.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
+dependencies = [
+ "bitflags 2.9.0",
+ "cfg-if",
+ "libc",
+]
+
[[package]]
name = "nix"
version = "0.28.0"
@@ -3989,6 +4315,7 @@ dependencies = [
"cfg-if",
"cfg_aliases 0.2.1",
"libc",
+ "memoffset",
]
[[package]]
@@ -4757,6 +5084,16 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
+[[package]]
+name = "ordered-stream"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50"
+dependencies = [
+ "futures-core",
+ "pin-project-lite",
+]
+
[[package]]
name = "ort"
version = "2.0.0-rc.6"
@@ -4799,6 +5136,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+[[package]]
+name = "parking"
+version = "2.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
+
[[package]]
name = "parking_lot"
version = "0.12.3"
@@ -4908,6 +5251,17 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+[[package]]
+name = "piper"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
+dependencies = [
+ "atomic-waker",
+ "fastrand",
+ "futures-io",
+]
+
[[package]]
name = "pkcs1"
version = "0.7.5"
@@ -4976,6 +5330,21 @@ dependencies = [
"miniz_oxide",
]
+[[package]]
+name = "polling"
+version = "3.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f"
+dependencies = [
+ "cfg-if",
+ "concurrent-queue",
+ "hermit-abi 0.4.0",
+ "pin-project-lite",
+ "rustix",
+ "tracing",
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "port_check"
version = "0.2.1"
@@ -5198,6 +5567,25 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "quick-xml"
+version = "0.36.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe"
+dependencies = [
+ "memchr",
+ "serde",
+]
+
+[[package]]
+name = "quick-xml"
+version = "0.37.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf763ab1c7a3aa408be466efc86efe35ed1bd3dd74173ed39d6b0d0a6f0ba148"
+dependencies = [
+ "memchr",
+]
+
[[package]]
name = "quote"
version = "1.0.40"
@@ -5808,7 +6196,7 @@ version = "1.1.10"
source = "git+https://github.com/louis030195/rusty-tesseract.git?branch=main#08346c1de08d122c7121425abc79081c30dbf778"
dependencies = [
"dirs",
- "image",
+ "image 0.25.5",
"log",
"subprocess",
"substring",
@@ -5979,7 +6367,7 @@ dependencies = [
"chrono",
"criterion",
"futures",
- "image",
+ "image 0.25.5",
"libsqlite3-sys",
"oasgen",
"rand 0.8.5",
@@ -6016,7 +6404,7 @@ name = "screenpipe-integrations"
version = "0.2.74"
dependencies = [
"anyhow",
- "image",
+ "image 0.25.5",
"log",
"mime_guess",
"reqwest 0.12.12",
@@ -6050,7 +6438,7 @@ dependencies = [
"fastrand",
"futures",
"hf-hub",
- "image",
+ "image 0.25.5",
"killport",
"lru",
"ndarray 0.15.6",
@@ -6094,13 +6482,16 @@ version = "0.2.74"
dependencies = [
"accessibility-sys 0.1.3",
"anyhow",
+ "atspi",
+ "atspi-common",
+ "atspi-proxies",
"base64 0.22.1",
"cidre 0.7.0",
"clap",
"core-foundation 0.10.0",
"criterion",
"futures-util",
- "image",
+ "image 0.25.5",
"image-compare",
"libc",
"memory-stats",
@@ -6124,6 +6515,7 @@ dependencies = [
"which 6.0.3",
"windows 0.58.0",
"xcap",
+ "zbus",
]
[[package]]
@@ -6656,7 +7048,7 @@ dependencies = [
"crossbeam-queue",
"dotenvy",
"either",
- "event-listener",
+ "event-listener 2.5.3",
"futures-channel",
"futures-core",
"futures-intrusive",
@@ -6851,6 +7243,12 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+[[package]]
+name = "static_assertions"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+
[[package]]
name = "strength_reduce"
version = "0.2.4"
@@ -7872,6 +8270,17 @@ version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
+[[package]]
+name = "uds_windows"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
+dependencies = [
+ "memoffset",
+ "tempfile",
+ "winapi",
+]
+
[[package]]
name = "ug"
version = "0.1.0"
@@ -8269,6 +8678,76 @@ dependencies = [
"web-sys",
]
+[[package]]
+name = "wayland-backend"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b7208998eaa3870dad37ec8836979581506e0c5c64c20c9e79e9d2a10d6f47bf"
+dependencies = [
+ "cc",
+ "downcast-rs",
+ "rustix",
+ "smallvec",
+ "wayland-sys",
+]
+
+[[package]]
+name = "wayland-client"
+version = "0.31.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c2120de3d33638aaef5b9f4472bff75f07c56379cf76ea320bd3a3d65ecaf73f"
+dependencies = [
+ "bitflags 2.9.0",
+ "rustix",
+ "wayland-backend",
+ "wayland-scanner",
+]
+
+[[package]]
+name = "wayland-protocols"
+version = "0.31.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4"
+dependencies = [
+ "bitflags 2.9.0",
+ "wayland-backend",
+ "wayland-client",
+ "wayland-scanner",
+]
+
+[[package]]
+name = "wayland-protocols-wlr"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6"
+dependencies = [
+ "bitflags 2.9.0",
+ "wayland-backend",
+ "wayland-client",
+ "wayland-protocols",
+ "wayland-scanner",
+]
+
+[[package]]
+name = "wayland-scanner"
+version = "0.31.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "896fdafd5d28145fce7958917d69f2fd44469b1d4e861cb5961bcbeebc6d1484"
+dependencies = [
+ "proc-macro2",
+ "quick-xml 0.37.3",
+ "quote",
+]
+
+[[package]]
+name = "wayland-sys"
+version = "0.31.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dbcebb399c77d5aa9fa5db874806ee7b4eba4e73650948e8f93963f128896615"
+dependencies = [
+ "pkg-config",
+]
+
[[package]]
name = "web-sys"
version = "0.3.77"
@@ -8462,6 +8941,28 @@ dependencies = [
"windows-targets 0.53.0",
]
+[[package]]
+name = "windows"
+version = "0.60.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ddf874e74c7a99773e62b1c671427abf01a425e77c3d3fb9fb1e4883ea934529"
+dependencies = [
+ "windows-collections",
+ "windows-core 0.60.1",
+ "windows-future",
+ "windows-link",
+ "windows-numerics",
+]
+
+[[package]]
+name = "windows-collections"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5467f79cc1ba3f52ebb2ed41dbb459b8e7db636cc3429458d9a852e15bc24dec"
+dependencies = [
+ "windows-core 0.60.1",
+]
+
[[package]]
name = "windows-core"
version = "0.52.0"
@@ -8507,6 +9008,29 @@ dependencies = [
"windows-targets 0.53.0",
]
+[[package]]
+name = "windows-core"
+version = "0.60.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ca21a92a9cae9bf4ccae5cf8368dce0837100ddf6e6d57936749e85f152f6247"
+dependencies = [
+ "windows-implement 0.59.0",
+ "windows-interface 0.59.1",
+ "windows-link",
+ "windows-result 0.3.2",
+ "windows-strings 0.3.1",
+]
+
+[[package]]
+name = "windows-future"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a787db4595e7eb80239b74ce8babfb1363d8e343ab072f2ffe901400c03349f0"
+dependencies = [
+ "windows-core 0.60.1",
+ "windows-link",
+]
+
[[package]]
name = "windows-implement"
version = "0.58.0"
@@ -8557,6 +9081,16 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
+[[package]]
+name = "windows-numerics"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "005dea54e2f6499f2cee279b8f703b3cf3b5734a2d8d21867c8f44003182eeed"
+dependencies = [
+ "windows-core 0.60.1",
+ "windows-link",
+]
+
[[package]]
name = "windows-registry"
version = "0.2.0"
@@ -8951,13 +9485,15 @@ dependencies = [
[[package]]
name = "xcap"
-version = "0.4.0"
-source = "git+https://github.com/nashaofu/xcap.git?rev=09c11cc67a37434f6cdcf73f3305ee8608dac83c#09c11cc67a37434f6cdcf73f3305ee8608dac83c"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eabd25cdb442bb7f63f13fdee2f59d991b04668d37c69aee00dc2a1cc9d0e9a1"
dependencies = [
"dbus",
"dispatch2",
- "image",
+ "image 0.25.5",
"lazy_static",
+ "libwayshot",
"log",
"objc2 0.6.0",
"objc2-app-kit 0.3.0",
@@ -8971,7 +9507,7 @@ dependencies = [
"scopeguard",
"thiserror 2.0.12",
"widestring",
- "windows 0.59.0",
+ "windows 0.60.0",
"xcb",
]
@@ -8983,7 +9519,17 @@ checksum = "f1e2f212bb1a92cd8caac8051b829a6582ede155ccb60b5d5908b81b100952be"
dependencies = [
"bitflags 1.3.2",
"libc",
- "quick-xml",
+ "quick-xml 0.30.0",
+]
+
+[[package]]
+name = "xdg-home"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6"
+dependencies = [
+ "libc",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -9042,6 +9588,107 @@ dependencies = [
"synstructure",
]
+[[package]]
+name = "zbus"
+version = "5.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59c333f648ea1b647bc95dc1d34807c8e25ed7a6feff3394034dc4776054b236"
+dependencies = [
+ "async-broadcast",
+ "async-executor",
+ "async-fs",
+ "async-io",
+ "async-lock",
+ "async-process",
+ "async-recursion",
+ "async-task",
+ "async-trait",
+ "blocking",
+ "enumflags2",
+ "event-listener 5.4.0",
+ "futures-core",
+ "futures-lite",
+ "hex",
+ "nix 0.29.0",
+ "ordered-stream",
+ "serde",
+ "serde_repr",
+ "static_assertions",
+ "tokio",
+ "tracing",
+ "uds_windows",
+ "windows-sys 0.59.0",
+ "winnow",
+ "xdg-home",
+ "zbus_macros",
+ "zbus_names",
+ "zvariant",
+]
+
+[[package]]
+name = "zbus-lockstep"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a22426b1bc2aca91de97772506f0655fa373448e6010d79d5d5880915c388409"
+dependencies = [
+ "zbus_xml",
+ "zvariant",
+]
+
+[[package]]
+name = "zbus-lockstep-macros"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "100ffec29ed51859052f4563061abe35557acb56ba574510571f8398efc70a29"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.100",
+ "zbus-lockstep",
+ "zbus_xml",
+ "zvariant",
+]
+
+[[package]]
+name = "zbus_macros"
+version = "5.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f325ad10eb0d0a3eb060203494c3b7ec3162a01a59db75d2deee100339709fc0"
+dependencies = [
+ "proc-macro-crate",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.100",
+ "zbus_names",
+ "zvariant",
+ "zvariant_utils",
+]
+
+[[package]]
+name = "zbus_names"
+version = "4.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97"
+dependencies = [
+ "serde",
+ "static_assertions",
+ "winnow",
+ "zvariant",
+]
+
+[[package]]
+name = "zbus_xml"
+version = "5.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589e9a02bfafb9754bb2340a9e3b38f389772684c63d9637e76b1870377bec29"
+dependencies = [
+ "quick-xml 0.36.2",
+ "serde",
+ "static_assertions",
+ "zbus_names",
+ "zvariant",
+]
+
[[package]]
name = "zerocopy"
version = "0.7.35"
@@ -9295,3 +9942,45 @@ checksum = "99a5bab8d7dedf81405c4bb1f2b83ea057643d9cb28778cea9eecddeedd2e028"
dependencies = [
"zune-core",
]
+
+[[package]]
+name = "zvariant"
+version = "5.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2df9ee044893fcffbdc25de30546edef3e32341466811ca18421e3cd6c5a3ac"
+dependencies = [
+ "endi",
+ "enumflags2",
+ "serde",
+ "static_assertions",
+ "winnow",
+ "zvariant_derive",
+ "zvariant_utils",
+]
+
+[[package]]
+name = "zvariant_derive"
+version = "5.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "74170caa85b8b84cc4935f2d56a57c7a15ea6185ccdd7eadb57e6edd90f94b2f"
+dependencies = [
+ "proc-macro-crate",
+ "proc-macro2",
+ "quote",
+ "syn 2.0.100",
+ "zvariant_utils",
+]
+
+[[package]]
+name = "zvariant_utils"
+version = "3.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e16edfee43e5d7b553b77872d99bc36afdda75c223ca7ad5e3fbecd82ca5fc34"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "serde",
+ "static_assertions",
+ "syn 2.0.100",
+ "winnow",
+]
diff --git a/screenpipe-vision/Cargo.toml b/screenpipe-vision/Cargo.toml
index 4c77b87f9..eea67829f 100644
--- a/screenpipe-vision/Cargo.toml
+++ b/screenpipe-vision/Cargo.toml
@@ -40,7 +40,7 @@ tracing = { workspace = true }
which = "6.0"
serde = "1.0.200"
-xcap = { git = "https://github.com/nashaofu/xcap.git", rev = "09c11cc67a37434f6cdcf73f3305ee8608dac83c" }
+xcap = "0.4.1"
once_cell = { workspace = true }
base64 = "0.22.1"
@@ -95,3 +95,7 @@ url = "2.5.0"
[target.'cfg(target_os = "linux")'.dependencies]
libc = "=0.2.164"
+atspi = { version = "0.25.0", features = ["tokio","proxies-tokio","zbus"] }
+zbus = { version = "5.5", default-features = false }
+atspi-common = { version = "0.9.0", default-features = false }
+atspi-proxies = { version = "0.9.0", default-features = false }
diff --git a/screenpipe-vision/src/browser_utils/linux.rs b/screenpipe-vision/src/browser_utils/linux.rs
new file mode 100644
index 000000000..83ae4397b
--- /dev/null
+++ b/screenpipe-vision/src/browser_utils/linux.rs
@@ -0,0 +1,271 @@
+use anyhow::{Result, anyhow};
+use tracing::{debug, error};
+use atspi::{
+ connection::set_session_accessibility,
+ proxy::accessible::{AccessibleProxy, ObjectRefExt},
+ zbus::{proxy::CacheProperties, Connection},
+ AccessibilityConnection, RelationType, Role,
+};
+use atspi_proxies::document::DocumentProxy;
+use atspi_common::State;
+use zbus::fdo::DBusProxy;
+use std::pin::Pin;
+use std::future::Future;
+
+use super::BrowserUrlDetector;
+
+const REGISTRY_DEST: &str = "org.a11y.atspi.Registry";
+const REGISTRY_PATH: &str = "/org/a11y/atspi/accessible/root";
+const ACCCESSIBLE_INTERFACE: &str = "org.a11y.atspi.Accessible";
+
+pub struct LinuxUrlDetector;
+
+impl LinuxUrlDetector {
+ pub fn new() -> Self {
+ Self
+ }
+
+ fn validate_url(url: &str) -> Option<String> {
+ if url.is_empty() {
+ return None;
+ }
+
+ // If URL already has a protocol, validate it
+ if url.starts_with("http://") || url.starts_with("https://") {
+ return Some(url.to_string());
+ }
+
+ None
+ }
+
+ async fn setup_connection() -> Result<(AccessibilityConnection, AccessibleProxy<'static>)> {
+ // Enable accessibility for the session
+ set_session_accessibility(true).await?;
+
+ // Create a connection to the accessibility bus
+ let connection = AccessibilityConnection::new().await?;
+
+ // Get the root accessible object
+ let root = Self::get_registry_accessible(connection.connection()).await?;
+
+ Ok((connection, root))
+ }
+
+ async fn get_registry_accessible(conn: &Connection) -> Result<AccessibleProxy<'static>> {
+ let registry = AccessibleProxy::builder(conn)
+ .destination(REGISTRY_DEST)?
+ .path(REGISTRY_PATH)?
+ .interface(ACCCESSIBLE_INTERFACE)?
+ .cache_properties(CacheProperties::No)
+ .build()
+ .await?;
+
+ Ok(registry)
+ }
+
+ async fn find_browser_process<'a>(
+ conn: &'a Connection,
+ root: &AccessibleProxy<'_>,
+ target_pid: i32,
+ ) -> Result<(AccessibleProxy<'a>, bool)> {
+ let child_objects = root.get_children().await?;
+
+ for child in child_objects {
+ let proxy = child.into_accessible_proxy(conn).await?;
+ if let Ok(application) = proxy.get_application().await {
+ // Only create DBusProxy if we have a potential match
+ let dbus_proxy = DBusProxy::new(conn).await?;
+ if let Ok(unique_name) = dbus_proxy.get_name_owner((&application.name).into()).await {
+ if let Ok(pid) = dbus_proxy.get_connection_unix_process_id(unique_name.into()).await {
+ if pid == target_pid as u32 {
+ debug!("Found browser process with PID: {}", pid);
+ return Ok((proxy, false));
+ }
+ }
+ }
+ }
+ }
+
+ Err(anyhow!("No browser process found with PID {}", target_pid))
+ }
+
+ async fn find_active_frame<'a>(
+ conn: &'a Connection,
+ browser_proxy: &AccessibleProxy<'_>,
+ window_title: &str,
+ ) -> Result<Option<AccessibleProxy<'a>>> {
+ let frames = browser_proxy.get_children().await?;
+
+ for frame in frames {
+ let frame_proxy = frame.into_accessible_proxy(conn).await?;
+ if frame_proxy.get_role().await? == Role::Frame {
+ // Try title first
+ if let Ok(title) = frame_proxy.name().await {
+ if title == window_title {
+ debug!("Found matching frame by title: {}", title);
+ return Ok(Some(frame_proxy));
+ }
+ }
+
+ // Then try state
+ let state = frame_proxy.get_state().await?;
+ if state.contains(State::Focused) ||
+ state.contains(State::Active) ||
+ state.contains(State::Selected) {
+ debug!("Found active frame by state: {}", frame_proxy.name().await.unwrap_or_default());
+ return Ok(Some(frame_proxy));
+ }
+ }
+ }
+ Ok(None)
+ }
+
+ async fn get_embed_relation<'a>(
+ conn: &'a Connection,
+ frame_proxy: &AccessibleProxy<'_>,
+ ) -> Result<Vec<AccessibleProxy<'a>>> {
+ let relation_set = frame_proxy.get_relation_set().await?;
+ let embed_targets = relation_set
+ .into_iter()
+ .find(|(relation_type, _)| *relation_type == RelationType::Embeds)
+ .map(|(_, targets)| targets)
+ .ok_or_else(|| anyhow!("No embed relation found"))?;
+
+ let mut accessible_proxies = Vec::new();
+ for target in embed_targets {
+ let proxy = AccessibleProxy::builder(conn)
+ .destination(target.name.to_string())?
+ .path(target.path.to_string())?
+ .interface(ACCCESSIBLE_INTERFACE)?
+ .build()
+ .await?;
+ accessible_proxies.push(proxy);
+ }
+ Ok(accessible_proxies)
+ }
+
+ async fn create_document_proxy<'a>(
+ conn: &'a Connection,
+ document_proxy: &AccessibleProxy<'_>,
+ ) -> Result<DocumentProxy<'a>> {
+ let inner = document_proxy.inner();
+ DocumentProxy::builder(conn)
+ .destination(inner.destination().to_string())?
+ .path(inner.path().to_string())?
+ .interface("org.a11y.atspi.Document")?
+ .build()
+ .await
+ .map_err(|e| anyhow!("Failed to create document proxy: {}", e))
+ }
+
+ async fn get_url_from_document(
+ document_proxy: &DocumentProxy<'_>,
+ _is_vivaldi: bool,
+ ) -> Result<Option<String>> {
+ // Try DocURL first
+ if let Ok(doc_url) = document_proxy.get_attribute_value("DocURL").await {
+ if let Some(url) = Self::validate_url(&doc_url) {
+ return Ok(Some(url));
+ }
+ }
+
+ // If DocURL fails or is empty, try URI
+ if let Ok(doc_url) = document_proxy.get_attribute_value("URI").await {
+ if let Some(url) = Self::validate_url(&doc_url) {
+ return Ok(Some(url));
+ }
+ }
+
+ Ok(None)
+ }
+
+ async fn find_document_web_with_url<'a>(
+ conn: &'a Connection,
+ targets: Vec<AccessibleProxy<'a>>,
+ is_vivaldi: bool,
+ ) -> Result<AccessibleProxy<'a>> {
+ for target in targets {
+ if target.get_role().await? == Role::DocumentWeb {
+ let doc_proxy = Self::create_document_proxy(conn, &target).await?;
+ if let Ok(Some(url)) = Self::get_url_from_document(&doc_proxy, is_vivaldi).await {
+ debug!("Found DocumentWeb with valid URL: {}", url);
+ return Ok(target);
+ }
+ }
+
+ // For Vivaldi, recursively check children
+ if is_vivaldi {
+ if let Ok(children) = target.get_children().await {
+ let mut child_proxies = Vec::new();
+ for child in children {
+ if let Ok(proxy) = child.into_accessible_proxy(conn).await {
+ child_proxies.push(proxy);
+ }
+ }
+
+ // Box the recursive call to fix the recursion issue
+ let future: Pin<Box<dyn Future<Output = Result<AccessibleProxy<'a>>> + 'a>> =
+ Box::pin(Self::find_document_web_with_url(conn, child_proxies, is_vivaldi));
+ if let Ok(result) = future.await {
+ return Ok(result);
+ }
+ }
+ }
+ }
+ Err(anyhow!("No DocumentWeb role found with valid URL"))
+ }
+
+ async fn get_document_url_from_relation(
+ conn: &Connection,
+ frame_proxy: &AccessibleProxy<'_>,
+ is_vivaldi: bool,
+ ) -> Result<Option<String>> {
+ let embed_targets = Self::get_embed_relation(conn, frame_proxy).await?;
+ let document_proxy = Self::find_document_web_with_url(conn, embed_targets, is_vivaldi).await?;
+ let document = Self::create_document_proxy(conn, &document_proxy).await?;
+ Self::get_url_from_document(&document, is_vivaldi).await
+ }
+
+ async fn get_active_url_from_window(pid: i32, window_title: &str, app_name: &str) -> Result<Option<String>> {
+ let (connection, root) = Self::setup_connection().await?;
+ let conn = connection.connection();
+ let is_vivaldi = app_name.to_lowercase().contains("vivaldi");
+
+ match Self::find_browser_process(conn, &root, pid).await {
+ Ok((browser_proxy, _)) => {
+ // Find the active frame first
+ if let Ok(Some(frame_proxy)) = Self::find_active_frame(conn, &browser_proxy, window_title).await {
+ match Self::get_document_url_from_relation(conn, &frame_proxy, is_vivaldi).await {
+ Ok(Some(url)) => {
+ debug!("Found URL: {}", url);
+ Ok(Some(url))
+ }
+ Ok(None) => {
+ debug!("No URL found in active frame");
+ Ok(None)
+ }
+ Err(e) => {
+ error!("Error getting URL from relation: {}", e);
+ Ok(None)
+ }
+ }
+ } else {
+ debug!("No active frame found");
+ Ok(None)
+ }
+ }
+ Err(e) => {
+ error!("Error finding browser process: {}", e);
+ Ok(None)
+ }
+ }
+ }
+}
+
+impl BrowserUrlDetector for LinuxUrlDetector {
+ fn get_active_url(&self, app_name: &str, process_id: i32, window_title: &str) -> Result<Option<String>> {
+ tokio::runtime::Runtime::new()
+ .unwrap()
+ .block_on(Self::get_active_url_from_window(process_id, window_title, app_name))
+ }
+}
\ No newline at end of file
diff --git a/screenpipe-vision/src/browser_utils/macos.rs b/screenpipe-vision/src/browser_utils/macos.rs
index f90b13975..5cb697a05 100644
--- a/screenpipe-vision/src/browser_utils/macos.rs
+++ b/screenpipe-vision/src/browser_utils/macos.rs
@@ -139,7 +139,7 @@ impl MacOSUrlDetector {
}
impl BrowserUrlDetector for MacOSUrlDetector {
- fn get_active_url(&self, app_name: &str, process_id: i32) -> Result<Option<String>> {
+ fn get_active_url(&self, app_name: &str, process_id: i32, _window_title: &str) -> Result<Option<String>> {
if app_name == "Arc" {
let script = r#"tell application "Arc" to return URL of active tab of front window"#;
self.get_url_via_applescript(script)
diff --git a/screenpipe-vision/src/browser_utils/mod.rs b/screenpipe-vision/src/browser_utils/mod.rs
index e972420ff..733c6d578 100644
--- a/screenpipe-vision/src/browser_utils/mod.rs
+++ b/screenpipe-vision/src/browser_utils/mod.rs
@@ -2,7 +2,7 @@ use anyhow::Result;
// Trait definition
pub trait BrowserUrlDetector {
- fn get_active_url(&self, app_name: &str, process_id: i32) -> Result<Option<String>>;
+ fn get_active_url(&self, app_name: &str, process_id: i32, window_title: &str) -> Result<Option<String>>;
}
// Factory function
@@ -14,32 +14,22 @@ pub fn create_url_detector() -> Box<dyn BrowserUrlDetector> {
return Box::new(WindowsUrlDetector::new());
#[cfg(target_os = "linux")]
- return Box::new(UnsupportedUrlDetector::new());
-}
-
-// Unsupported implementation
-pub struct UnsupportedUrlDetector;
-
-impl UnsupportedUrlDetector {
- pub fn new() -> Self {
- Self
- }
-}
-
-impl BrowserUrlDetector for UnsupportedUrlDetector {
- fn get_active_url(&self, _app_name: &str, _process_id: i32) -> Result<Option<String>> {
- Ok(None)
- }
+ return Box::new(LinuxUrlDetector::new());
}
// Re-export MacOS implementation
#[cfg(target_os = "macos")]
mod macos;
#[cfg(target_os = "macos")]
-pub use macos::MacOSUrlDetector;
+pub use macos::MacOSUrlDetector;
#[cfg(target_os = "windows")]
mod windows;
#[cfg(target_os = "windows")]
-pub use windows::WindowsUrlDetector;
+pub use windows::WindowsUrlDetector;
+
+#[cfg(target_os = "linux")]
+mod linux;
+#[cfg(target_os = "linux")]
+pub use linux::LinuxUrlDetector;
diff --git a/screenpipe-vision/src/browser_utils/windows.rs b/screenpipe-vision/src/browser_utils/windows.rs
index e4a5cf5eb..dc674e638 100644
--- a/screenpipe-vision/src/browser_utils/windows.rs
+++ b/screenpipe-vision/src/browser_utils/windows.rs
@@ -81,7 +81,7 @@ impl WindowsUrlDetector {
}
impl BrowserUrlDetector for WindowsUrlDetector {
- fn get_active_url(&self, _app_name: &str, process_id: i32) -> Result<Option<String>> {
+ fn get_active_url(&self, _app_name: &str, process_id: i32, _window_title: &str) -> Result<Option<String>> {
return Self::get_active_url_from_window(process_id);
}
}
diff --git a/screenpipe-vision/src/core.rs b/screenpipe-vision/src/core.rs
index e937bb2d4..3467f72e4 100644
--- a/screenpipe-vision/src/core.rs
+++ b/screenpipe-vision/src/core.rs
@@ -378,6 +378,7 @@ async fn process_window_ocr(
&app_name,
captured_window.is_focused,
captured_window.process_id,
+ &captured_window.window_name,
)
.await;
@@ -409,16 +410,17 @@ async fn get_browser_url_if_needed(
app_name: &str,
is_focused: bool,
process_id: i32,
+ window_title: &str,
) -> Option<String> {
- if cfg!(not(target_os = "linux"))
- && is_focused
+ if is_focused
&& BROWSER_NAMES
.iter()
.any(|&browser| app_name.to_lowercase().contains(browser))
{
let app_name = app_name.to_string(); // Clone to move into the closure
+ let window_title = window_title.to_string(); // Clone to move into the closure
match tokio::task::spawn_blocking(move || {
- get_active_browser_url_sync(&app_name, process_id)
+ get_active_browser_url_sync(&app_name, process_id, &window_title)
})
.await
{
@@ -576,17 +578,17 @@ impl UIFrame {
}
}
-fn get_active_browser_url_sync(app_name: &str, process_id: i32) -> Result<String, std::io::Error> {
+fn get_active_browser_url_sync(app_name: &str, process_id: i32, window_title: &str) -> Result<String, std::io::Error> {
let detector = create_url_detector();
- match detector.get_active_url(app_name, process_id) {
+ match detector.get_active_url(app_name, process_id, window_title) {
Ok(Some(url)) => Ok(url),
Ok(None) => Err(std::io::Error::new(
- std::io::ErrorKind::Other,
- "Failed to get browser URL",
+ std::io::ErrorKind::NotFound,
+ "No active URL found",
)),
Err(e) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
- format!("Error getting browser URL: {}", e),
+ format!("Failed to get active URL: {}", e),
)),
}
}