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

iterate on app + better ffmpeg setup

Louis Beaumont8546c55b69a1
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 50e5a06b3..199204460 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -1,59 +1,84 @@
# # Run for macOS
-# act -W .github/workflows/release-app.yml --container-architecture linux/amd64 -j release -P macos-latest=-self-hosted
+# act -W .github/workflows/release-app.yml --container-architecture linux/amd64 -j publish-tauri -P macos-latest=-self-hosted
# # Run for Linux
-# act -W .github/workflows/release-app.yml --container-architecture linux/amd64 -j release -P ubuntu-22.04=-self-hosted
+# act -W .github/workflows/release-app.yml --container-architecture linux/amd64 -j publish-tauri -P ubuntu-22.04=-self-hosted
-name: "Release app"
+name: Release
on:
- push:
- tags:
- - "v*"
+ push:
+ tags:
+ - "v*"
+ workflow_dispatch:
jobs:
- release:
- permissions:
- contents: write
- strategy:
- fail-fast: false
- matrix:
- platform: [macos-latest, ubuntu-22.04, windows-latest]
- runs-on: ${{ matrix.platform }}
-
- steps:
- - uses: actions/checkout@v4
-
- - name: install dependencies (ubuntu only)
- if: matrix.platform == 'ubuntu-22.04'
- run: |
- sudo apt-get update
- sudo apt-get install -y libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
-
- - name: setup node
- uses: actions/setup-node@v4
- with:
- node-version: "lts/*"
-
- - name: setup rust
- uses: dtolnay/rust-toolchain@stable
-
- - name: install frontend dependencies
- working-directory: examples/apps/screen-pipe-app/
- run: npm i
-
- - uses: tauri-apps/tauri-action@v0
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- projectPath: examples/apps/screen-pipe-app/
- tagName: ${{ github.ref_name }}
- releaseName: "App v__VERSION__"
- releaseBody: "See the assets to download and install this version."
- releaseDraft: true
- prerelease: false
- distPath: "../examples/apps/screen-pipe-app/dist"
- appVersion: ${{ github.ref_name }}
+ publish-tauri:
+ permissions:
+ contents: write
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - platform: "macos-latest" # for Arm based macs (M1 and above).
+ args: "--target aarch64-apple-darwin"
+ - platform: "macos-latest" # for Intel based macs.
+ args: "--target x86_64-apple-darwin"
+ - platform: "ubuntu-24.04" # Ubuntu x86_64
+ args: ""
+ - platform: "windows-latest" # Windows x86_64
+ args: '--target x86_64-pc-windows-msvc --features "openblas"'
+ pre-build-args: "--openblas"
+
+ runs-on: ${{ matrix.platform }}
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: setup Bun
+ uses: oven-sh/setup-bun@v1
+
+ - name: Rust cache
+ uses: swatinem/rust-cache@v2
+
+ - name: Install Rust stable
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
+ targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
+
+ - name: Install frontend dependencies
+ run: bun install
+ working-directory: ./examples/apps/screenpipe-app-tauri
+
+ - name: Cache Pre Build
+ id: cache-pre-build
+ uses: actions/cache@v4
+ with:
+ path: |
+ examples/apps/screenpipe-app-tauri/src-tauri/openblas
+ examples/apps/screenpipe-app-tauri/src-tauri/clblast
+ examples/apps/screenpipe-app-tauri/src-tauri/ffmpeg
+ key: ${{ matrix.platform }}-${{ matrix.args }}-pre-build
+
+ # Run pre build
+ - name: Run pre_build.js on ${{ matrix.platform }}
+ run: bun ./examples/apps/screenpipe-app-tauri/scripts/pre_build.js ${{ matrix.pre-build-args }}
+
+ - name: Build
+ uses: tauri-apps/tauri-action@v0
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
+ TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
+ with:
+ tagName: v__VERSION__ # the action automatically replaces __VERSION__ with the app version.
+ releaseName: "v__VERSION__"
+ releaseBody: "What's new? 🎉📣"
+ releaseDraft: true
+ prerelease: true
+ args: ${{ matrix.args }}
+ projectPath: "./examples/apps/screenpipe-app-tauri"
+ tauriScript: bunx tauri
diff --git a/Cargo.toml b/Cargo.toml
index d26669263..b21d41f02 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
[workspace]
-members = ["screenpipe-server", "screenpipe-vision", "screenpipe-audio", "examples/apps/screen-pipe-app/src-tauri", "examples/apps/screenpipe-app-dioxus"]
+members = ["screenpipe-server", "screenpipe-vision", "screenpipe-audio", "examples/apps/screenpipe-app-tauri/src-tauri", "examples/apps/screenpipe-app-dioxus", "screenpipe-core"]
exclude = []
resolver = "2"
diff --git a/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite b/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite
deleted file mode 100644
index 4ebf78cf9..000000000
Binary files a/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite and /dev/null differ
diff --git a/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite-shm b/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite-shm
deleted file mode 100644
index 7e9f7788f..000000000
Binary files a/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite-shm and /dev/null differ
diff --git a/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite-wal b/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite-wal
deleted file mode 100644
index 4684f1b9e..000000000
Binary files a/examples/apps/screen-pipe-app/src-tauri/null/db.sqlite-wal and /dev/null differ
diff --git a/examples/apps/screen-pipe-app/src-tauri/tauri.conf.json b/examples/apps/screen-pipe-app/src-tauri/tauri.conf.json
deleted file mode 100644
index 96fdfc144..000000000
--- a/examples/apps/screen-pipe-app/src-tauri/tauri.conf.json
+++ /dev/null
@@ -1,110 +0,0 @@
-{
- "$schema": "../node_modules/@tauri-apps/cli/schema.json",
- "build": {
- "beforeBuildCommand": "pnpm run build",
- "beforeDevCommand": "pnpm run dev",
- "frontendDist": "../out",
- "devUrl": "http://localhost:3000"
- },
- "bundle": {
- "active": true,
- "category": "DeveloperTool",
- "copyright": "",
- "targets": "all",
- "externalBin": [],
- "icon": [
- "icons/generated/Assets.xcassets/AppIcon.appiconset/32.png",
- "icons/generated/Assets.xcassets/AppIcon.appiconset/128.png",
- "icons/generated/Assets.xcassets/AppIcon.appiconset/256.png",
- "icons/generated/Assets.xcassets/AppIcon.appiconset/512.png",
- "icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png",
- "icons/generated/icon.icns",
- "icons/generated/icon.ico"
- ],
- "windows": {
- "certificateThumbprint": null,
- "digestAlgorithm": "sha256",
- "timestampUrl": ""
- },
- "longDescription": "",
- "macOS": {
- "entitlements": null,
- "exceptionDomain": "",
- "frameworks": [],
- "providerShortName": null,
- "signingIdentity": null
- },
- "resources": [],
- "shortDescription": "",
- "linux": {
- "deb": {
- "depends": []
- }
- },
- "createUpdaterArtifacts": true
- },
- "productName": "screenpipe",
- "version": "0.1.0",
- "identifier": "com.screenpi.pe",
- "plugins": {
- "cli": {
- "description": "Screen Pipe App CLI",
- "longDescription": "Command-line interface for Screen Pipe App",
- "args": [
- {
- "name": "data-dir",
- "takesValue": true,
- "description": "Custom data directory path"
- },
- {
- "name": "fps",
- "takesValue": true,
- "description": "FPS for continuous recording (default: 1.0)"
- },
- {
- "name": "audio-chunk-duration",
- "takesValue": true,
- "description": "Audio chunk duration in seconds (default: 30)"
- },
- {
- "name": "port",
- "takesValue": true,
- "description": "Port to run the server on (default: 3035)"
- },
- {
- "name": "disable-audio",
- "description": "Disable audio recording"
- },
- {
- "name": "memory-threshold",
- "takesValue": true,
- "description": "Memory usage threshold for restart in percentage (default: 80.0)"
- },
- {
- "name": "runtime-threshold",
- "takesValue": true,
- "description": "Runtime threshold for restart in minutes (default: 60)"
- },
- {
- "name": "debug",
- "description": "Enable debug mode"
- }
- ]
- },
- "updater": {
- "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIyQjQ2RkQzMUNBOUFDMTcKUldRWHJLa2MwMiswSWl3RlBGUW5zYUE0Zm0vNFFRRTltNUZZTUVxR2FxUDNtSWdUSHgyL3JNcmcK",
- "endpoints": [
- "https://github.com/louis030195/screenpipe/releases/latest/download/latest.json"
- ]
- }
- },
- "app": {
- "security": {
- "csp": null
- },
- "trayIcon": {
- "iconPath": "icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png",
- "iconAsTemplate": true
- }
- }
-}
\ No newline at end of file
diff --git a/examples/apps/screenpipe-app-dioxus/src/main.rs b/examples/apps/screenpipe-app-dioxus/src/main.rs
index 7b8d6f95d..6a0416be6 100644
--- a/examples/apps/screenpipe-app-dioxus/src/main.rs
+++ b/examples/apps/screenpipe-app-dioxus/src/main.rs
@@ -240,6 +240,12 @@ async fn start_screenpipe() -> anyhow::Result<(
.filter_module("rusty_tesseract", LevelFilter::Error)
.filter_module("symphonia", LevelFilter::Error);
+ let debug = true;
+
+ if debug {
+ builder.filter(Some("screenpipe"), LevelFilter::Debug);
+ }
+
let base_dir = get_local_dir(None)?;
fs::create_dir_all(&base_dir)?;
diff --git a/examples/apps/screen-pipe-app/.eslintrc.json b/examples/apps/screenpipe-app-tauri/.eslintrc.json
similarity index 100%
rename from examples/apps/screen-pipe-app/.eslintrc.json
rename to examples/apps/screenpipe-app-tauri/.eslintrc.json
diff --git a/examples/apps/screen-pipe-app/.gitignore b/examples/apps/screenpipe-app-tauri/.gitignore
similarity index 97%
rename from examples/apps/screen-pipe-app/.gitignore
rename to examples/apps/screenpipe-app-tauri/.gitignore
index fd3dbb571..ccd7f81b1 100644
--- a/examples/apps/screen-pipe-app/.gitignore
+++ b/examples/apps/screenpipe-app-tauri/.gitignore
@@ -34,3 +34,7 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
+
+
+
+ffmpeg*
diff --git a/examples/apps/screen-pipe-app/README.md b/examples/apps/screenpipe-app-tauri/README.md
similarity index 83%
rename from examples/apps/screen-pipe-app/README.md
rename to examples/apps/screenpipe-app-tauri/README.md
index a5e7cc722..6bfaa138c 100644
--- a/examples/apps/screen-pipe-app/README.md
+++ b/examples/apps/screenpipe-app-tauri/README.md
@@ -8,7 +8,7 @@ releasing app:
```
export TAURI_SIGNING_PRIVATE_KEY="$HOME/.tauri/myapp.key"
export TAURI_SIGNING_PRIVATE_KEY_PASSWORD=""
-pnpm tauri build
+pnpm tauri build -- --features metal
# todo rest
```
diff --git a/examples/apps/screen-pipe-app/app/favicon.ico b/examples/apps/screenpipe-app-tauri/app/favicon.ico
similarity index 100%
rename from examples/apps/screen-pipe-app/app/favicon.ico
rename to examples/apps/screenpipe-app-tauri/app/favicon.ico
diff --git a/examples/apps/screen-pipe-app/app/globals.css b/examples/apps/screenpipe-app-tauri/app/globals.css
similarity index 100%
rename from examples/apps/screen-pipe-app/app/globals.css
rename to examples/apps/screenpipe-app-tauri/app/globals.css
diff --git a/examples/apps/screen-pipe-app/app/layout.tsx b/examples/apps/screenpipe-app-tauri/app/layout.tsx
similarity index 100%
rename from examples/apps/screen-pipe-app/app/layout.tsx
rename to examples/apps/screenpipe-app-tauri/app/layout.tsx
diff --git a/examples/apps/screen-pipe-app/app/page.tsx b/examples/apps/screenpipe-app-tauri/app/page.tsx
similarity index 100%
rename from examples/apps/screen-pipe-app/app/page.tsx
rename to examples/apps/screenpipe-app-tauri/app/page.tsx
diff --git a/examples/apps/screenpipe-app-tauri/bun.lockb b/examples/apps/screenpipe-app-tauri/bun.lockb
new file mode 100755
index 000000000..f5b15ffab
Binary files /dev/null and b/examples/apps/screenpipe-app-tauri/bun.lockb differ
diff --git a/examples/apps/screen-pipe-app/next.config.mjs b/examples/apps/screenpipe-app-tauri/next.config.mjs
similarity index 100%
rename from examples/apps/screen-pipe-app/next.config.mjs
rename to examples/apps/screenpipe-app-tauri/next.config.mjs
diff --git a/examples/apps/screen-pipe-app/package.json b/examples/apps/screenpipe-app-tauri/package.json
similarity index 90%
rename from examples/apps/screen-pipe-app/package.json
rename to examples/apps/screenpipe-app-tauri/package.json
index c9d19d92b..bfafb0ad0 100644
--- a/examples/apps/screen-pipe-app/package.json
+++ b/examples/apps/screenpipe-app-tauri/package.json
@@ -1,12 +1,13 @@
{
- "name": "screen-pipe-app",
+ "name": "screenpipe-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
- "build": "next build",
"start": "next start",
- "lint": "next lint"
+ "lint": "next lint",
+ "build": "next build",
+ "tauri": "tauri"
},
"dependencies": {
"@tauri-apps/plugin-cli": "2.0.0-beta.7",
diff --git a/examples/apps/screen-pipe-app/pnpm-lock.yaml b/examples/apps/screenpipe-app-tauri/pnpm-lock.yaml
similarity index 100%
rename from examples/apps/screen-pipe-app/pnpm-lock.yaml
rename to examples/apps/screenpipe-app-tauri/pnpm-lock.yaml
diff --git a/examples/apps/screen-pipe-app/postcss.config.mjs b/examples/apps/screenpipe-app-tauri/postcss.config.mjs
similarity index 100%
rename from examples/apps/screen-pipe-app/postcss.config.mjs
rename to examples/apps/screenpipe-app-tauri/postcss.config.mjs
diff --git a/examples/apps/screen-pipe-app/public/next.svg b/examples/apps/screenpipe-app-tauri/public/next.svg
similarity index 100%
rename from examples/apps/screen-pipe-app/public/next.svg
rename to examples/apps/screenpipe-app-tauri/public/next.svg
diff --git a/examples/apps/screen-pipe-app/public/vercel.svg b/examples/apps/screenpipe-app-tauri/public/vercel.svg
similarity index 100%
rename from examples/apps/screen-pipe-app/public/vercel.svg
rename to examples/apps/screenpipe-app-tauri/public/vercel.svg
diff --git a/examples/apps/screenpipe-app-tauri/scripts/pre_build.js b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
new file mode 100644
index 000000000..f2b01c857
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/scripts/pre_build.js
@@ -0,0 +1,298 @@
+import { $ } from 'bun'
+import fs from 'fs/promises'
+import os from 'os'
+import path from 'path'
+
+
+
+const originalCWD = process.cwd()
+// Change CWD to src-tauri
+process.chdir(path.join(__dirname, '../src-tauri'))
+const platform = {
+ win32: 'windows',
+ darwin: 'macos',
+ linux: 'linux',
+}[os.platform()]
+const cwd = process.cwd()
+
+function hasFeature(name) {
+ return process.argv.includes(`--${name}`) || process.argv.includes(name)
+}
+
+const config = {
+ ffmpegRealname: 'ffmpeg',
+ openblasRealname: 'openblas',
+ clblastRealname: 'clblast',
+ windows: {
+ ffmpegName: 'ffmpeg-7.0-windows-desktop-vs2022-default',
+ ffmpegUrl: 'https://unlimited.dl.sourceforge.net/project/avbuild/windows-desktop/ffmpeg-7.0-windows-desktop-vs2022-default.7z?viasf=1',
+
+ openBlasName: 'OpenBLAS-0.3.26-x64',
+ openBlasUrl: 'https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.26/OpenBLAS-0.3.26-x64.zip',
+
+ clblastName: 'CLBlast-1.6.2-windows-x64',
+ clblastUrl: 'https://github.com/CNugteren/CLBlast/releases/download/1.6.2/CLBlast-1.6.2-windows-x64.zip',
+
+ vcpkgPackages: ['opencl'],
+ },
+ linux: {
+ aptPackages: [
+ 'ffmpeg',
+ 'libopenblas-dev', // Runtime
+ 'pkg-config',
+ 'build-essential',
+ 'libglib2.0-dev',
+ 'libgtk-3-dev',
+ 'libwebkit2gtk-4.1-dev',
+ 'clang',
+ 'cmake', // Tauri
+ 'libavutil-dev',
+ 'libavformat-dev',
+ 'libavfilter-dev',
+ 'libavdevice-dev', // FFMPEG
+ 'libasound2-dev', // cpal
+ 'libomp-dev', // OpenMP in ggml.ai
+ 'libstdc++-12-dev', //ROCm
+ ],
+ },
+ macos: {
+ ffmpegName: 'ffmpeg-7.0-macOS-default',
+ ffmpegUrl: 'https://master.dl.sourceforge.net/project/avbuild/macOS/ffmpeg-7.0-macOS-default.tar.xz?viasf=1',
+ },
+}
+
+// Export for Github actions
+const exports = {
+ ffmpeg: path.join(cwd, config.ffmpegRealname),
+ openBlas: path.join(cwd, config.openblasRealname),
+ clblast: path.join(cwd, config.clblastRealname, 'lib/cmake/CLBlast'),
+ libClang: 'C:\\Program Files\\LLVM\\bin',
+ cmake: 'C:\\Program Files\\CMake\\bin',
+}
+
+/* ########## Linux ########## */
+if (platform == 'linux') {
+ // Install APT packages
+ await $`sudo apt-get update`
+ if (hasFeature('opencl')) {
+ config.linux.aptPackages.push('libclblast-dev')
+ }
+ for (const name of config.linux.aptPackages) {
+ await $`sudo apt-get install -y ${name}`
+ }
+}
+
+/* ########## Windows ########## */
+if (platform == 'windows') {
+ // Setup FFMPEG
+ if (!(await fs.exists(config.ffmpegRealname))) {
+ await $`C:\\msys64\\usr\\bin\\wget.exe -nc --show-progress ${config.windows.ffmpegUrl} -O ${config.windows.ffmpegName}.7z`
+ await $`'C:\\Program Files\\7-Zip\\7z.exe' x ${config.windows.ffmpegName}.7z`
+ await $`mv ${config.windows.ffmpegName} ${config.ffmpegRealname}`
+ await $`rm -rf ${config.windows.ffmpegName}.7z`
+ await $`mv ${config.ffmpegRealname}/lib/x64/* ${config.ffmpegRealname}/lib/`
+ }
+
+ // Setup OpenBlas
+ if (!(await fs.exists(config.openblasRealname)) && hasFeature('openblas')) {
+ await $`C:\\msys64\\usr\\bin\\wget.exe -nc --show-progress ${config.windows.openBlasUrl} -O ${config.windows.openBlasName}.zip`
+ await $`"C:\\Program Files\\7-Zip\\7z.exe" x ${config.windows.openBlasName}.zip -o${config.openblasRealname}`
+ await $`rm ${config.windows.openBlasName}.zip`
+ fs.cp(path.join(config.openblasRealname, 'include'), path.join(config.openblasRealname, 'lib'), { recursive: true, force: true })
+ // It tries to link only openblas.lib but our is libopenblas.lib`
+ fs.cp(path.join(config.openblasRealname, 'lib/libopenblas.lib'), path.join(config.openblasRealname, 'lib/openblas.lib'))
+ }
+
+ // Setup CLBlast
+ if (!(await fs.exists(config.clblastRealname)) && !hasFeature('cuda')) {
+ await $`C:\\msys64\\usr\\bin\\wget.exe -nc --show-progress ${config.windows.clblastUrl} -O ${config.windows.clblastName}.zip`
+ await $`"C:\\Program Files\\7-Zip\\7z.exe" x ${config.windows.clblastName}.zip` // 7z file inside
+ await $`"C:\\Program Files\\7-Zip\\7z.exe" x ${config.windows.clblastName}.7z` // Inner folder
+ await $`mv ${config.windows.clblastName} ${config.clblastRealname}`
+ await $`rm ${config.windows.clblastName}.zip`
+ await $`rm ${config.windows.clblastName}.7z`
+ }
+
+ // Setup vcpkg packages
+ await $`C:\\vcpkg\\vcpkg.exe install ${config.windows.vcpkgPackages}`.quiet()
+}
+
+/* ########## macOS ########## */
+if (platform == 'macos') {
+ // Setup FFMPEG
+ if (!(await fs.exists(config.ffmpegRealname))) {
+ await $`wget -nc --show-progress ${config.macos.ffmpegUrl} -O ${config.macos.ffmpegName}.tar.xz`
+ await $`tar xf ${config.macos.ffmpegName}.tar.xz`
+ await $`mv ${config.macos.ffmpegName} ${config.ffmpegRealname}`
+ await $`rm ${config.macos.ffmpegName}.tar.xz`
+ }
+}
+
+// Nvidia
+let cudaPath
+if (hasFeature('cuda')) {
+ if (process.env['CUDA_PATH']) {
+ cudaPath = process.env['CUDA_PATH']
+ } else if (platform === 'windows') {
+ const cudaRoot = 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\'
+ cudaPath = 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v12.5'
+ if (await fs.exists(cudaRoot)) {
+ const folders = await fs.readdir(cudaRoot)
+ if (folders.length > 0) {
+ cudaPath = cudaPath.replace('v12.5', folders[0])
+ }
+ }
+ }
+
+ if (process.env.GITHUB_ENV) {
+ console.log('CUDA_PATH', cudaPath)
+ }
+
+ if (platform === 'windows') {
+ const windowsConfig = {
+ bundle: {
+ resources: {
+ 'ffmpeg\\bin\\x64\\*': './',
+ 'openblas\\bin\\*.dll': './',
+ [`${cudaPath}\\bin\\cudart64_*`]: './',
+ [`${cudaPath}\\bin\\cublas64_*`]: './',
+ [`${cudaPath}\\bin\\cublasLt64_*`]: './',
+ },
+ },
+ }
+ await fs.writeFile('tauri.windows.conf.json', JSON.stringify(windowsConfig, null, 4))
+ }
+ if (platform === 'linux') {
+ // Add cuda toolkit depends package
+ const tauriConfigContent = await fs.readFile('tauri.linux.conf.json', { encoding: 'utf-8' })
+ const tauriConfig = JSON.parse(tauriConfigContent)
+ tauriConfig.bundle.linux.deb.depends.push('nvidia-cuda-toolkit')
+ await fs.writeFile('tauri.linux.conf.json', JSON.stringify(tauriConfig, null, 4))
+ }
+}
+
+if (hasFeature('opencl')) {
+ if (platform === 'windows') {
+ const tauriConfigContent = await fs.readFile('tauri.windows.conf.json', { encoding: 'utf-8' })
+ const tauriConfig = JSON.parse(tauriConfigContent)
+ tauriConfig.bundle.resources['clblast\\bin\\*.dll'] = './'
+ tauriConfig.bundle.resources['C:\\vcpkg\\packages\\opencl_x64-windows\\bin\\*.dll'] = './'
+ await fs.writeFile('tauri.windows.conf.json', JSON.stringify(tauriConfig, null, 4))
+ }
+}
+
+// OpenBlas
+if (hasFeature('openblas')) {
+ if (platform === 'windows') {
+ const tauriConfigContent = await fs.readFile('tauri.windows.conf.json', { encoding: 'utf-8' })
+ const tauriConfig = JSON.parse(tauriConfigContent)
+ tauriConfig.bundle.resources['openblas\\bin\\*.dll'] = './'
+ await fs.writeFile('tauri.windows.conf.json', JSON.stringify(tauriConfig, null, 4))
+ }
+}
+
+// ROCM
+let rocmPath = '/opt/rocm'
+if (hasFeature('rocm')) {
+ if (process.env.GITHUB_ENV) {
+ console.log('ROCM_PATH', rocmPath)
+ }
+ if (platform === 'linux') {
+ // Add rocm toolkit depends package
+ const tauriConfigContent = await fs.readFile('tauri.linux.conf.json', { encoding: 'utf-8' })
+ const tauriConfig = JSON.parse(tauriConfigContent)
+ tauriConfig.bundle.linux.deb.depends.push('rocm')
+ await fs.writeFile('tauri.linux.conf.json', JSON.stringify(tauriConfig, null, 4))
+ }
+}
+
+// Development hints
+if (!process.env.GITHUB_ENV) {
+ console.log('\nCommands to build 🔨:')
+ if (originalCWD != cwd) {
+ // Get relative path to desktop folder
+ const relativePath = path.relative(originalCWD, path.join(cwd, '..'))
+ console.log(`cd ${relativePath}`)
+ }
+ console.log('bun install')
+ if (platform == 'windows') {
+ console.log(`$env:FFMPEG_DIR = "${exports.ffmpeg}"`)
+ console.log(`$env:OPENBLAS_PATH = "${exports.openBlas}"`)
+ console.log(`$env:LIBCLANG_PATH = "${exports.libClang}"`)
+ console.log(`$env:PATH += "${exports.cmake}"`)
+ if (hasFeature('older-cpu')) {
+ console.log(`$env:WHISPER_NO_AVX = "ON"`)
+ console.log(`$env:WHISPER_NO_AVX2 = "ON"`)
+ console.log(`$env:WHISPER_NO_FMA = "ON"`)
+ console.log(`$env:WHISPER_NO_F16C = "ON"`)
+ }
+ if (hasFeature('cuda')) {
+ console.log(`$env:CUDA_PATH = "${cudaPath}"`)
+ }
+ if (hasFeature('opencl')) {
+ console.log(`$env:CLBlast_DIR = "${exports.clblast}"`)
+ }
+ if (hasFeature('rocm')) {
+ console.log(`$env:ROCM_VERSION = "6.1.2"`)
+ console.log(`$env:ROCM_PATH = "${rocmPath}"`)
+ }
+ }
+ if (platform == 'macos') {
+ console.log(`export FFMPEG_DIR="${exports.ffmpeg}"`)
+ console.log(`export WHISPER_METAL_EMBED_LIBRARY=ON`)
+ }
+ if (!process.env.GITHUB_ENV) {
+ console.log('bunx tauri build')
+ }
+}
+
+// Config Github ENV
+if (process.env.GITHUB_ENV) {
+ console.log('Adding ENV')
+ if (platform == 'macos' || platform == 'windows') {
+ const ffmpeg = `FFMPEG_DIR=${exports.ffmpeg}\n`
+ console.log('Adding ENV', ffmpeg)
+ await fs.appendFile(process.env.GITHUB_ENV, ffmpeg)
+ }
+ if (platform == 'macos') {
+ const embed_metal = 'WHISPER_METAL_EMBED_LIBRARY=ON'
+ await fs.appendFile(process.env.GITHUB_ENV, embed_metal)
+ }
+ if (platform == 'windows') {
+ const openblas = `OPENBLAS_PATH=${exports.openBlas}\n`
+ console.log('Adding ENV', openblas)
+ await fs.appendFile(process.env.GITHUB_ENV, openblas)
+
+ if (hasFeature('opencl')) {
+ const clblast = `CLBlast_DIR=${exports.clblast}\n`
+ console.log('Adding ENV', clblast)
+ await fs.appendFile(process.env.GITHUB_ENV, clblast)
+ }
+
+ if (hasFeature('older-cpu')) {
+ await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_AVX=ON\n`)
+ await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_AVX2=ON\n`)
+ await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_FMA=ON\n`)
+ await fs.appendFile(process.env.GITHUB_ENV, `WHISPER_NO_F16C=ON\n`)
+ }
+ }
+}
+
+// --dev or --build
+const action = process.argv?.[2]
+if (action?.includes('--build' || action.includes('--dev'))) {
+ process.chdir(path.join(cwd, '..'))
+ process.env['FFMPEG_DIR'] = exports.ffmpeg
+ if (platform === 'windows') {
+ process.env['OPENBLAS_PATH'] = exports.openBlas
+ process.env['CLBlast_DIR'] = exports.clblast
+ process.env['LIBCLANG_PATH'] = exports.libClang
+ process.env['PATH'] = `${process.env['PATH']};${exports.cmake}`
+ }
+ if (platform == 'macos') {
+ process.env['WHISPER_METAL_EMBED_LIBRARY'] = 'ON'
+ }
+ await $`bun install`
+ await $`bunx tauri ${action.includes('--dev') ? 'dev' : 'build'}`
+}
+
diff --git a/examples/apps/screen-pipe-app/src-tauri/.gitignore b/examples/apps/screenpipe-app-tauri/src-tauri/.gitignore
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/.gitignore
rename to examples/apps/screenpipe-app-tauri/src-tauri/.gitignore
diff --git a/examples/apps/screen-pipe-app/src-tauri/Cargo.toml b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
similarity index 99%
rename from examples/apps/screen-pipe-app/src-tauri/Cargo.toml
rename to examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 65d78b033..41f317f31 100644
--- a/examples/apps/screen-pipe-app/src-tauri/Cargo.toml
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -51,6 +51,8 @@ tauri-plugin-shell = "2.0.0-alpha.2"
tauri-plugin-store = "2.0.0-beta"
+anyhow = "1.0.71"
+
# M series MacOS
[target.'cfg(target_os = "macos")'.dependencies]
screenpipe-server = { path = "../../../../screenpipe-server", features = ["metal"] }
diff --git a/examples/apps/screen-pipe-app/src-tauri/build.rs b/examples/apps/screenpipe-app-tauri/src-tauri/build.rs
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/build.rs
rename to examples/apps/screenpipe-app-tauri/src-tauri/build.rs
diff --git a/examples/apps/screen-pipe-app/src-tauri/capabilities/main.json b/examples/apps/screenpipe-app-tauri/src-tauri/capabilities/main.json
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/capabilities/main.json
rename to examples/apps/screenpipe-app-tauri/src-tauri/capabilities/main.json
diff --git a/examples/apps/screen-pipe-app/src-tauri/gen/schemas/acl-manifests.json b/examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/acl-manifests.json
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/gen/schemas/acl-manifests.json
rename to examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/acl-manifests.json
diff --git a/examples/apps/screen-pipe-app/src-tauri/gen/schemas/capabilities.json b/examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/gen/schemas/capabilities.json
rename to examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
diff --git a/examples/apps/screen-pipe-app/src-tauri/gen/schemas/desktop-schema.json b/examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/desktop-schema.json
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/gen/schemas/desktop-schema.json
rename to examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/desktop-schema.json
diff --git a/examples/apps/screen-pipe-app/src-tauri/gen/schemas/macOS-schema.json b/examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/macOS-schema.json
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/gen/schemas/macOS-schema.json
rename to examples/apps/screenpipe-app-tauri/src-tauri/gen/schemas/macOS-schema.json
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/128x128.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/128x128.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/128x128.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/128x128.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/[email protected] b/examples/apps/screenpipe-app-tauri/src-tauri/icons/[email protected]
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/[email protected]
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/[email protected]
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/32x32.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/32x32.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/32x32.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/32x32.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square107x107Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square107x107Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square107x107Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square107x107Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square142x142Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square142x142Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square142x142Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square142x142Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square150x150Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square150x150Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square150x150Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square150x150Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square284x284Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square284x284Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square284x284Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square284x284Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square30x30Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square30x30Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square30x30Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square30x30Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square310x310Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square310x310Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square310x310Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square310x310Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square44x44Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square44x44Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square44x44Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square44x44Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square71x71Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square71x71Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square71x71Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square71x71Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/Square89x89Logo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/Square89x89Logo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/Square89x89Logo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/Square89x89Logo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/StoreLogo.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/StoreLogo.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/StoreLogo.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/StoreLogo.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/100.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/100.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/100.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/100.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/114.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/114.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/114.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/114.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/120.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/120.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/120.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/120.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/128.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/128.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/128.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/128.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/144.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/144.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/144.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/144.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/152.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/152.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/152.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/152.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/16.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/16.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/16.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/16.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/167.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/167.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/167.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/167.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/180.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/180.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/180.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/180.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/20.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/20.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/20.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/20.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/256.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/256.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/256.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/256.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/29.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/29.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/29.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/29.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/32.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/32.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/32.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/32.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/40.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/40.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/40.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/40.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/50.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/50.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/50.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/50.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/512.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/512.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/512.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/512.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/57.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/57.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/57.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/57.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/58.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/58.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/58.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/58.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/60.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/60.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/60.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/60.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/64.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/64.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/64.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/64.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/72.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/72.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/72.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/72.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/76.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/76.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/76.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/76.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/80.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/80.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/80.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/80.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/87.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/87.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/87.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/87.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/Contents.json b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/Contents.json
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/Contents.json
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/Assets.xcassets/AppIcon.appiconset/Contents.json
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/appstore.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/appstore.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/appstore.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/appstore.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/icon.icns b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/icon.icns
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/icon.icns
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/icon.icns
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/icon.ico b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/icon.ico
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/icon.ico
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/icon.ico
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/generated/playstore.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/playstore.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/generated/playstore.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/generated/playstore.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/icon.icns b/examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.icns
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/icon.icns
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.icns
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/icon.ico b/examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.ico
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/icon.ico
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.ico
diff --git a/examples/apps/screen-pipe-app/src-tauri/icons/icon.png b/examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.png
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/icons/icon.png
rename to examples/apps/screenpipe-app-tauri/src-tauri/icons/icon.png
diff --git a/examples/apps/screen-pipe-app/src-tauri/src/analytics.rs b/examples/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/src/analytics.rs
rename to examples/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
diff --git a/examples/apps/screen-pipe-app/src-tauri/src/logs.rs b/examples/apps/screenpipe-app-tauri/src-tauri/src/logs.rs
similarity index 100%
rename from examples/apps/screen-pipe-app/src-tauri/src/logs.rs
rename to examples/apps/screenpipe-app-tauri/src-tauri/src/logs.rs
diff --git a/examples/apps/screen-pipe-app/src-tauri/src/main.rs b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
similarity index 64%
rename from examples/apps/screen-pipe-app/src-tauri/src/main.rs
rename to examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 3a8fe4c61..ab79b74fc 100644
--- a/examples/apps/screen-pipe-app/src-tauri/src/main.rs
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -2,19 +2,16 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use dirs::home_dir;
-use log::{error, info, LevelFilter};
+use log::{debug, error, info, LevelFilter};
use logs::MultiWriter;
use screenpipe_audio::{
- default_input_device, default_output_device, list_audio_devices, DeviceControl,
+ default_input_device, default_output_device, list_audio_devices, parse_audio_device,
+ AudioDevice, DeviceControl,
};
use screenpipe_server::{start_continuous_recording, DatabaseManager, ResourceMonitor, Server};
-use serde::{Deserialize, Serialize};
use serde_json::Value;
-use tauri::{State, Wry};
-use tauri_plugin_shell::ShellExt;
-use tauri_plugin_store::{with_store, StoreCollection};
-
+use std::collections::HashMap;
use std::fs::File;
use std::io::Write;
use std::ops::Deref;
@@ -30,7 +27,11 @@ use tauri::{
tray::TrayIconBuilder,
Manager,
};
+use tauri::{State, Wry};
use tauri_plugin_cli::CliExt;
+use tauri_plugin_shell::ShellExt;
+use tauri_plugin_store::{with_store, StoreCollection};
+use tokio::sync::mpsc;
use tauri_plugin_autostart::MacosLauncher;
mod analytics;
@@ -39,26 +40,16 @@ use analytics::AnalyticsManager;
use crate::analytics::start_analytics;
mod logs;
-fn ensure_local_data_dir(
- custom_path: Option<String>,
-) -> Result<String, Box<dyn std::error::Error>> {
+fn get_base_dir(custom_path: Option<String>) -> anyhow::Result<PathBuf> {
let default_path = home_dir()
- .ok_or("Failed to get home directory")?
- .join(".screenpipe")
- .join("data");
+ .ok_or("Failed to get home directory")
+ .unwrap()
+ .join(".screenpipe");
let local_data_dir = custom_path.map(PathBuf::from).unwrap_or(default_path);
fs::create_dir_all(&local_data_dir)?;
- Ok(local_data_dir.to_string_lossy().into_owned())
-}
-
-async fn initialize_database(local_data_dir: Arc<String>) -> Arc<DatabaseManager> {
- Arc::new(
- DatabaseManager::new(&format!("{}/db.sqlite", local_data_dir))
- .await
- .unwrap(),
- )
+ Ok(local_data_dir)
}
#[derive(Default)]
@@ -66,17 +57,81 @@ struct TrayState {
menu: Option<tauri::menu::Menu<tauri::Wry>>,
}
-#[derive(Serialize, Deserialize)]
-struct Preferences {
- autostart_enabled: bool,
-}
+async fn initialize_audio(
+ disable_audio: bool,
+ custom_devices: &[String],
+ audio_devices_control_sender: Arc<tokio::sync::mpsc::Sender<(AudioDevice, DeviceControl)>>,
+) -> (Vec<Arc<AudioDevice>>, HashMap<AudioDevice, DeviceControl>) {
+ debug!(
+ "Entering initialize_audio function, disable_audio={}",
+ disable_audio
+ );
+ let mut audio_devices = Vec::new();
+ let mut devices_status = HashMap::new();
+
+ if disable_audio {
+ info!("Audio recording is disabled");
+ return (audio_devices, devices_status);
+ }
+
+ info!("Initializing audio devices...");
+ let all_audio_devices = list_audio_devices().unwrap_or_default();
+
+ for device in all_audio_devices {
+ let device_control = DeviceControl {
+ is_running: false,
+ is_paused: false,
+ };
+ info!("Audio device: {:?}", device.to_string());
+ devices_status.insert(device, device_control);
+ }
-impl Default for Preferences {
- fn default() -> Self {
- Self {
- autostart_enabled: true, // Set to true by default
+ if custom_devices.is_empty() {
+ if let Ok(input_device) = default_input_device() {
+ info!("Default input device found: {:?}", input_device.to_string());
+ audio_devices.push(Arc::new(input_device));
+ }
+ if let Ok(output_device) = default_output_device() {
+ info!(
+ "Default output device found: {:?}",
+ output_device.to_string()
+ );
+ audio_devices.push(Arc::new(output_device));
+ }
+ } else {
+ for device_str in custom_devices {
+ if let Ok(device) = parse_audio_device(device_str) {
+ info!("Custom device added: {:?}", device.to_string());
+ audio_devices.push(Arc::new(device));
+ } else {
+ error!("Failed to parse audio device: {}", device_str);
+ }
+ }
+ }
+
+ if audio_devices.is_empty() {
+ error!("No audio devices available. Audio recording will be disabled.");
+ } else {
+ info!("Using audio devices:");
+ for device in &audio_devices {
+ info!(" {}", device);
+
+ let device_control = DeviceControl {
+ is_running: true,
+ is_paused: false,
+ };
+ let device_clone = device.deref().clone();
+ let sender_clone = audio_devices_control_sender.clone();
+ // send signal after everything started
+ tokio::spawn(async move {
+ tokio::time::sleep(Duration::from_secs(15)).await;
+ let _ = sender_clone.send((device_clone, device_control)).await;
+ });
}
}
+
+ debug!("Exiting initialize_audio function");
+ (audio_devices, devices_status)
}
async fn setup_server_and_recording(
@@ -89,68 +144,27 @@ async fn setup_server_and_recording(
disable_audio: bool,
memory_threshold: f64,
runtime_threshold: u64,
+) -> (
+ Vec<Arc<AudioDevice>>,
+ Arc<tokio::sync::mpsc::Sender<(AudioDevice, DeviceControl)>>,
) {
+ debug!("Entering setup_server_and_recording function");
info!("Setting up server and recording...");
info!("Configuration: port={}, fps={}, audio_chunk_duration={}s, disable_audio={}, memory_threshold={}%, runtime_threshold={}s",
port, fps, audio_chunk_duration, disable_audio, memory_threshold, runtime_threshold);
- let (audio_devices_control_sender, audio_devices_control_receiver) =
- tokio::sync::mpsc::channel(64);
- let mut audio_devices = Vec::new();
- let mut devices_status = std::collections::HashMap::new();
-
- if !disable_audio {
- info!("Initializing audio devices...");
- let all_audio_devices = list_audio_devices().unwrap_or_default();
+ let (audio_devices_control_sender, audio_devices_control_receiver) = mpsc::channel(64);
+ let audio_devices_control_sender = Arc::new(audio_devices_control_sender);
+ let audio_sender_for_server = audio_devices_control_sender.clone();
+ let audio_sender_for_return = audio_devices_control_sender.clone();
- for device in all_audio_devices {
- let device_control = DeviceControl {
- is_running: false,
- is_paused: false,
- };
- info!("Audio device: {:?}", device.to_string());
- devices_status.insert(device, device_control);
- }
-
- if let Ok(input_device) = default_input_device() {
- info!("Default input device found: {:?}", input_device.to_string());
- audio_devices.push(Arc::new(input_device.clone()));
- devices_status.get_mut(&input_device).unwrap().is_running = true;
- }
- if let Ok(output_device) = default_output_device() {
- info!(
- "Default output device found: {:?}",
- output_device.to_string()
- );
- audio_devices.push(Arc::new(output_device.clone()));
- devices_status.get_mut(&output_device).unwrap().is_running = true;
- }
-
- if audio_devices.is_empty() {
- error!("No audio devices available. Audio recording will be disabled.");
- } else {
- info!("Using audio devices:");
- for device in &audio_devices {
- info!(" {}", device);
- let device_clone = device.deref().clone();
- let sender_clone = audio_devices_control_sender.clone();
- tokio::spawn(async move {
- tokio::time::sleep(Duration::from_secs(15)).await;
- let _ = sender_clone
- .send((
- device_clone,
- DeviceControl {
- is_running: true,
- is_paused: false,
- },
- ))
- .await;
- });
- }
- }
- } else {
- info!("Audio recording is disabled");
- }
+ debug!("Initializing audio devices");
+ let (audio_devices, devices_status) = initialize_audio(
+ disable_audio,
+ &[], // No custom devices for the app version
+ audio_devices_control_sender,
+ )
+ .await;
info!("Starting resource monitoring...");
ResourceMonitor::new(memory_threshold, runtime_threshold, false)
@@ -201,7 +215,7 @@ async fn setup_server_and_recording(
db_server,
SocketAddr::from(([0, 0, 0, 0], port)),
vision_control_server_clone,
- audio_devices_control_sender,
+ audio_sender_for_server.deref().clone(),
);
info!("Starting server...");
@@ -211,6 +225,8 @@ async fn setup_server_and_recording(
});
info!("Server started on http://localhost:{}", port);
+
+ (audio_devices, audio_sender_for_return)
}
#[tokio::main]
@@ -233,53 +249,12 @@ async fn main() {
.setup(move |app| {
let cli = app.cli().matches().expect("Failed to get CLI matches");
- let local_data_dir = Arc::new(
- ensure_local_data_dir(
- cli.args
- .get("data-dir")
- .and_then(|v| Some(v.value.to_string())),
- )
- .expect("Failed to ensure local data directory"),
- );
-
- let port = cli
- .args
- .get("port")
- .and_then(|v| v.value.as_u64())
- .unwrap_or(3000) as u16;
- let fps = cli
- .args
- .get("fps")
- .and_then(|v| v.value.as_f64())
- .unwrap_or(30.0);
- let audio_chunk_duration = cli
- .args
- .get("audio-chunk-duration")
- .and_then(|v| v.value.as_u64())
- .unwrap_or(5);
- let disable_audio = cli
- .args
- .get("disable-audio")
- .and_then(|v| v.value.as_bool())
- .unwrap_or(false);
- let memory_threshold = cli
- .args
- .get("memory-threshold")
- .and_then(|v| v.value.as_f64())
- .unwrap_or(80.0);
- let runtime_threshold = cli
- .args
- .get("runtime-threshold")
- .and_then(|v| v.value.as_u64())
- .unwrap_or(3600);
+ let base_dir = get_base_dir(None).expect("Failed to ensure local data directory");
+ let port = 3030;
app.manage(port);
- let debug = cli
- .args
- .get("debug")
- .and_then(|v| v.value.as_bool())
- .unwrap_or(false);
+ let debug = true;
let mut builder = env_logger::Builder::new();
builder
@@ -292,14 +267,10 @@ async fn main() {
builder.filter_module("screenpipe", LevelFilter::Debug);
}
- // Add file logging
- let log_dir = home_dir()
- .ok_or("Failed to get home directory")?
- .join(".screenpipe");
+ debug!("all param: {:?}", cli.args);
let log_file =
- File::create(format!("{}/screenpipe.log", log_dir.to_string_lossy())).unwrap();
- // Create a multi-writer that writes to both file and stdout
+ File::create(format!("{}/screenpipe.log", base_dir.to_string_lossy())).unwrap();
let multi_writer = MultiWriter::new(vec![
Box::new(log_file) as Box<dyn Write + Send>,
Box::new(std::io::stdout()) as Box<dyn Write + Send>,
@@ -307,13 +278,15 @@ async fn main() {
builder.target(env_logger::Target::Pipe(Box::new(multi_writer)));
builder.format_timestamp_secs().init();
+
+ info!("Local data directory: {}", base_dir.display());
+
let posthog_api_key = "phc_Bt8GoTBPgkCpDrbaIZzJIEYt0CrJjhBiuLaBck1clce".to_string();
let app_name = "screenpipe";
- let interval_hours = 1; // Send event every 1 hour
+ let interval_hours = 1;
- let path = log_dir.join("store.bin");
+ let path = base_dir.join("store.bin");
- // create file if not exists
if !path.exists() {
let _ = File::create(path.clone()).unwrap();
}
@@ -321,18 +294,6 @@ async fn main() {
let stores = app.app_handle().state::<StoreCollection<Wry>>();
let _ = with_store(app.app_handle().clone(), stores, path, |store| {
- // Note that values must be serde_json::Value instances,
- // otherwise, they will not be compatible with the JavaScript bindings.
- // store.insert("some-key".to_string(), json!({ "value": 5 }))?;
-
- // Get a value from the store.
- // let value = store
- // .get("some-key")
- // .expect("Failed to get value from store");
- // println!("{}", value); // {"value":5}
-
- // You can manually save the store after making changes.
- // Otherwise, it will save upon graceful exit as described above.
store.save()?;
let is_analytics_enabled = store
@@ -355,25 +316,7 @@ async fn main() {
Ok(())
});
- let handle = app.app_handle().clone();
- tauri::async_runtime::spawn(async move {
- let db = initialize_database(local_data_dir.clone()).await;
- handle.manage(db.clone());
-
- setup_server_and_recording(
- handle,
- db,
- local_data_dir,
- port,
- fps,
- audio_chunk_duration,
- disable_audio,
- memory_threshold,
- runtime_threshold,
- )
- .await;
- });
-
+ // Tray setup
let quit_item = MenuItemBuilder::with_id("quit", "Quit").build(app)?;
let send_feedback_item =
MenuItemBuilder::with_id("send_feedback", "Send Feedback").build(app)?;
@@ -409,8 +352,8 @@ async fn main() {
let subject = "Screenpipe Feedback";
let body = r#"Please enter your feedback here...
- ... or let's chat?
- https://cal.com/louis030195/screenpipe
+ ... or let's chat?
+ https://cal.com/louis030195/screenpipe
"#;
let url = format!("mailto:{}?subject={}&body={}", email, subject, body);
let app_handle = app.app_handle();
@@ -442,5 +385,48 @@ async fn main() {
.expect("error while building tauri application");
// Run the app
- app.run(|_, _| {});
+ app.run(|app_handle, event| match event {
+ tauri::RunEvent::Ready { .. } => {
+ let app_handle = app_handle.clone();
+ start_server(app_handle);
+ }
+ _ => {}
+ });
+}
+
+fn start_server(app_handle: tauri::AppHandle) {
+ tokio::spawn(async move {
+ let base_dir = get_base_dir(None).expect("Failed to ensure local data directory");
+ let port = 3030;
+ let fps = 1.0;
+ let audio_chunk_duration = 30;
+ let disable_audio = true;
+ let memory_threshold = 80.0;
+ let runtime_threshold = 3600;
+
+ let db = Arc::new(
+ DatabaseManager::new(&format!(
+ "{}/db.sqlite",
+ base_dir.join("data").to_string_lossy()
+ ))
+ .await
+ .unwrap(),
+ );
+ app_handle.manage(db.clone());
+
+ let path = Arc::new(base_dir.join("data").to_string_lossy().into_owned());
+
+ setup_server_and_recording(
+ app_handle,
+ db,
+ path,
+ port,
+ fps,
+ audio_chunk_duration,
+ disable_audio,
+ memory_threshold,
+ runtime_threshold,
+ )
+ .await;
+ });
}
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
new file mode 100644
index 000000000..b8246be2f
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.conf.json
@@ -0,0 +1,75 @@
+{
+ "$schema": "../node_modules/@tauri-apps/cli/schema.json",
+ "build": {
+ "beforeDevCommand": "bun run dev",
+ "beforeBuildCommand": "bun run build",
+ "frontendDist": "../out",
+ "devUrl": "http://localhost:1420"
+ },
+ "bundle": {
+ "active": true,
+ "category": "DeveloperTool",
+ "copyright": "",
+ "targets": "all",
+ "externalBin": [],
+ "icon": [
+ "icons/generated/Assets.xcassets/AppIcon.appiconset/32.png",
+ "icons/generated/Assets.xcassets/AppIcon.appiconset/128.png",
+ "icons/generated/Assets.xcassets/AppIcon.appiconset/256.png",
+ "icons/generated/Assets.xcassets/AppIcon.appiconset/512.png",
+ "icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png",
+ "icons/generated/icon.icns",
+ "icons/generated/icon.ico"
+ ],
+ "longDescription": "",
+ "resources": [],
+ "shortDescription": "",
+ "fileAssociations": [
+ {
+ "description": "Video files",
+ "ext": [
+ "mp4",
+ "mkv",
+ "avi",
+ "mov",
+ "wmv",
+ "webm"
+ ]
+ },
+ {
+ "description": "Audio files",
+ "ext": [
+ "mp3",
+ "wav",
+ "aac",
+ "flac",
+ "oga",
+ "ogg",
+ "opic",
+ "opus"
+ ]
+ }
+ ],
+ "createUpdaterArtifacts": true
+ },
+ "productName": "screenpipe",
+ "version": "0.1.0",
+ "identifier": "com.screenpi.pe",
+ "plugins": {
+ "updater": {
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDIyQjQ2RkQzMUNBOUFDMTcKUldRWHJLa2MwMiswSWl3RlBGUW5zYUE0Zm0vNFFRRTltNUZZTUVxR2FxUDNtSWdUSHgyL3JNcmcK",
+ "endpoints": [
+ "https://github.com/louis030195/screenpipe/releases/latest/download/latest.json"
+ ]
+ }
+ },
+ "app": {
+ "security": {
+ "csp": null
+ },
+ "trayIcon": {
+ "iconPath": "icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png",
+ "iconAsTemplate": true
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
new file mode 100644
index 000000000..e4062ec54
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.linux.conf.json
@@ -0,0 +1,12 @@
+{
+ "bundle": {
+ "linux": {
+ "deb": {
+ "depends": [
+ "ffmpeg",
+ "libopenblas-dev"
+ ]
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
new file mode 100644
index 000000000..7e9a777be
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.macos.conf.json
@@ -0,0 +1,29 @@
+{
+ "bundle": {
+ "macOS": {
+ "frameworks": [
+ "ffmpeg/lib/libavcodec.61.dylib",
+ "ffmpeg/lib/libavdevice.61.dylib",
+ "ffmpeg/lib/libavfilter.10.dylib",
+ "ffmpeg/lib/libavformat.61.dylib",
+ "ffmpeg/lib/libavutil.59.dylib",
+ "ffmpeg/lib/libffmpeg.7.dylib",
+ "ffmpeg/lib/libswresample.5.dylib",
+ "ffmpeg/lib/libswscale.8.dylib"
+ ],
+ "signingIdentity": "-",
+ "hardenedRuntime": false,
+ "exceptionDomain": "com.screenpi.pe",
+ "dmg": {
+ "background": "./icons/generated/Assets.xcassets/AppIcon.appiconset/1024.png",
+ "windowSize": {
+ "height": 400,
+ "width": 660
+ }
+ }
+ },
+ "resources": {
+ "ffmpeg/bin/*": "./"
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/apps/screenpipe-app-tauri/src-tauri/tauri.windows.conf.json b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.windows.conf.json
new file mode 100644
index 000000000..50ad04615
--- /dev/null
+++ b/examples/apps/screenpipe-app-tauri/src-tauri/tauri.windows.conf.json
@@ -0,0 +1,7 @@
+{
+ "bundle": {
+ "resources": {
+ "ffmpeg\\bin\\x64\\*": "./"
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/apps/screen-pipe-app/tailwind.config.ts b/examples/apps/screenpipe-app-tauri/tailwind.config.ts
similarity index 100%
rename from examples/apps/screen-pipe-app/tailwind.config.ts
rename to examples/apps/screenpipe-app-tauri/tailwind.config.ts
diff --git a/examples/apps/screen-pipe-app/tsconfig.json b/examples/apps/screenpipe-app-tauri/tsconfig.json
similarity index 100%
rename from examples/apps/screen-pipe-app/tsconfig.json
rename to examples/apps/screenpipe-app-tauri/tsconfig.json
diff --git a/screenpipe-audio/Cargo.toml b/screenpipe-audio/Cargo.toml
index 448812d66..ffd710577 100644
--- a/screenpipe-audio/Cargo.toml
+++ b/screenpipe-audio/Cargo.toml
@@ -59,6 +59,8 @@ bytemuck = "1.16.1"
# Async
tokio = { workspace = true }
+screenpipe-core = { path = "../screenpipe-core" }
+
[dev-dependencies]
tempfile = "3.3.0"
infer = "0.15"
diff --git a/screenpipe-audio/src/core.rs b/screenpipe-audio/src/core.rs
index a384f9884..5c966ae9a 100644
--- a/screenpipe-audio/src/core.rs
+++ b/screenpipe-audio/src/core.rs
@@ -2,6 +2,7 @@ use anyhow::{anyhow, Result};
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
use cpal::StreamError;
use log::{debug, error, info, warn};
+use screenpipe_core::find_ffmpeg_path;
use serde::Serialize;
use std::path::PathBuf;
use std::process::Stdio;
@@ -121,7 +122,7 @@ async fn run_ffmpeg(
duration: Duration,
) -> Result<()> {
debug!("Starting FFmpeg process");
- let mut ffmpeg = Command::new("ffmpeg")
+ let mut ffmpeg = Command::new(find_ffmpeg_path().unwrap())
.args(&[
"-f",
"f32le",
diff --git a/screenpipe-core/Cargo.toml b/screenpipe-core/Cargo.toml
new file mode 100644
index 000000000..ac22c7184
--- /dev/null
+++ b/screenpipe-core/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "screenpipe-core"
+version = { workspace = true }
+authors = { workspace = true }
+description = { workspace = true }
+repository = { workspace = true }
+license = { workspace = true }
+edition = { workspace = true }
+
+[dependencies]
+which = "6.0.1"
+
+
diff --git a/screenpipe-core/src/ffmpeg.rs b/screenpipe-core/src/ffmpeg.rs
new file mode 100644
index 000000000..447662f33
--- /dev/null
+++ b/screenpipe-core/src/ffmpeg.rs
@@ -0,0 +1,48 @@
+use std::path::PathBuf;
+use which::which;
+
+#[cfg(windows)]
+use std::os::windows::process::CommandExt;
+
+#[cfg(not(windows))]
+const EXECUTABLE_NAME: &str = "ffmpeg";
+
+#[cfg(windows)]
+const EXECUTABLE_NAME: &str = "ffmpeg.exe";
+
+#[cfg(windows)]
+const CREATE_NO_WINDOW: u32 = 0x08000000;
+
+pub fn find_ffmpeg_path() -> Option<PathBuf> {
+ // Check if `ffmpeg` is in the PATH environment variable using the `which` crate
+ if let Ok(path) = which(EXECUTABLE_NAME) {
+ return Some(path);
+ }
+
+ // Check in current working directory
+ let cwd = std::env::current_dir().ok()?;
+ let ffmpeg_in_cwd = cwd.join(EXECUTABLE_NAME);
+ if ffmpeg_in_cwd.is_file() && ffmpeg_in_cwd.exists() {
+ return Some(ffmpeg_in_cwd);
+ }
+
+ // Check in the same folder as the executable
+ if let Ok(exe_path) = std::env::current_exe() {
+ let exe_folder = exe_path.parent()?;
+ let ffmpeg_in_exe_folder = exe_folder.join(EXECUTABLE_NAME);
+ if ffmpeg_in_exe_folder.exists() {
+ return Some(ffmpeg_in_exe_folder);
+ }
+ // For macOS, check in the Resources folder next to the executable
+ #[cfg(target_os = "macos")]
+ {
+ let resources_folder = exe_folder.join("../Resources");
+ let ffmpeg_in_resources = resources_folder.join(EXECUTABLE_NAME);
+ if ffmpeg_in_resources.exists() {
+ return Some(ffmpeg_in_resources);
+ }
+ }
+ }
+
+ None
+}
diff --git a/screenpipe-core/src/lib.rs b/screenpipe-core/src/lib.rs
new file mode 100644
index 000000000..8fc20b869
--- /dev/null
+++ b/screenpipe-core/src/lib.rs
@@ -0,0 +1,2 @@
+pub mod ffmpeg;
+pub use ffmpeg::find_ffmpeg_path;
diff --git a/screenpipe-server/Cargo.toml b/screenpipe-server/Cargo.toml
index d90461ab1..a7d1bfe85 100644
--- a/screenpipe-server/Cargo.toml
+++ b/screenpipe-server/Cargo.toml
@@ -15,6 +15,7 @@ serde_json = "1.0"
screenpipe-vision = { path = "../screenpipe-vision" }
screenpipe-audio = { path = "../screenpipe-audio" }
+screenpipe-core = { path = "../screenpipe-core" }
# Image processing
image = "0.25.0"
diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rs
index 729290679..a19f65a36 100644
--- a/screenpipe-server/src/server.rs
+++ b/screenpipe-server/src/server.rs
@@ -514,6 +514,9 @@ curl -X POST "http://localhost:3030/audio/status" -H "Content-Type: application/
echo "Searching for content:"
curl "http://localhost:3030/search?q=test&limit=5&offset=0&content_type=all" | jq
+curl "http://localhost:3030/search?limit=5&offset=0&content_type=ocr" | jq
+
+
*/
diff --git a/screenpipe-server/src/video.rs b/screenpipe-server/src/video.rs
index ca14ded04..0213321ff 100644
--- a/screenpipe-server/src/video.rs
+++ b/screenpipe-server/src/video.rs
@@ -1,19 +1,17 @@
use chrono::Utc;
use image::ImageFormat::{self};
use log::{debug, error, info, warn};
+use screenpipe_core::find_ffmpeg_path;
use screenpipe_vision::{continuous_capture, CaptureResult, ControlMessage};
use std::collections::VecDeque;
-use std::path::PathBuf;
use std::process::Stdio;
+use std::sync::Arc;
use tokio::io::AsyncWriteExt;
use tokio::io::{AsyncBufReadExt, BufReader};
use tokio::process::{Child, ChildStdin, Command};
-
-use std::sync::Arc;
use tokio::sync::mpsc::{channel, Receiver, Sender};
use tokio::sync::Mutex;
-use std::env;
use std::time::Duration;
const MAX_FPS: f64 = 30.0; // Adjust based on your needs
@@ -246,30 +244,6 @@ async fn save_frames_as_video(
}
}
-fn get_ffmpeg_path() -> PathBuf {
- if cfg!(target_os = "macos") {
- // When running on macOS, use the bundled FFmpeg
- let exe_path = env::current_exe().expect("Failed to get executable path");
- let resources_path = exe_path
- .parent()
- .unwrap()
- .parent()
- .unwrap()
- .join("Resources");
- let ffmpeg_path = resources_path.join("ffmpeg");
- // if not present, add a warning to the user
- if !ffmpeg_path.exists() {
- // and just use ffmpeg from path
- PathBuf::from("ffmpeg")
- } else {
- ffmpeg_path
- }
- } else {
- // On other platforms, assume FFmpeg is in PATH
- PathBuf::from("ffmpeg")
- }
-}
-
// TODO: use tokio::process::Command instead
fn start_ffmpeg_process(output_file: &str, fps: f64) -> Child {
// overrriding fps with max fps if over the max and warning user
@@ -280,7 +254,7 @@ fn start_ffmpeg_process(output_file: &str, fps: f64) -> Child {
}
info!("Starting FFmpeg process for file: {}", output_file);
- Command::new(get_ffmpeg_path().to_str().unwrap())
+ Command::new(find_ffmpeg_path().unwrap())
.args([
"-f",
"image2pipe",