Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

Performance improvements (#238)

Gabriel Stein8199204e4a5b
diff --git a/.github/workflows/build-and-notarize.yml b/.github/workflows/build-and-notarize.yml
index f61d7997d..3ef0cd449 100644
--- a/.github/workflows/build-and-notarize.yml
+++ b/.github/workflows/build-and-notarize.yml
@@ -2,143 +2,143 @@ name: Build and Notarize
on:
push:
- branches: [ main, develop ]
+ branches: [main, develop]
paths-ignore:
- - '**.md'
- - 'LICENSE'
- - '.github/ISSUE_TEMPLATE/**'
+ - "**.md"
+ - "LICENSE"
+ - ".github/ISSUE_TEMPLATE/**"
pull_request:
- branches: [ main ]
+ branches: [main]
paths-ignore:
- - '**.md'
- - 'LICENSE'
- - '.github/ISSUE_TEMPLATE/**'
+ - "**.md"
+ - "LICENSE"
+ - ".github/ISSUE_TEMPLATE/**"
workflow_dispatch:
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Install dependencies
- run: npm ci
-
- - name: Cache native binaries
- uses: actions/cache@v4
- with:
- path: resources/bin
- key: linux-x64-bin-${{ hashFiles('scripts/download-*.js') }}
-
- - name: Download whisper.cpp binaries
- run: node scripts/download-whisper-cpp.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download llama-server binaries
- run: node scripts/download-llama-server.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download sherpa-onnx binaries
- run: node scripts/download-sherpa-onnx.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Cache Electron
- uses: actions/cache@v4
- with:
- path: ~/.cache/electron
- key: linux-electron-${{ hashFiles('**/package-lock.json') }}
- restore-keys: linux-electron-
-
- - name: Install Linux packaging dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y rpm
-
- - name: Build Application
- run: npm run build:linux -- --publish never
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
- VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
- VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
-
- - name: Upload Artifacts
- uses: actions/upload-artifact@v4
- with:
- name: linux-build
- path: dist/
- retention-days: 7
+ - uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+ cache: "npm"
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Cache native binaries
+ uses: actions/cache@v4
+ with:
+ path: resources/bin
+ key: linux-x64-bin-${{ hashFiles('scripts/download-*.js') }}
+
+ - name: Download whisper.cpp binaries
+ run: node scripts/download-whisper-cpp.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download llama-server binaries
+ run: node scripts/download-llama-server.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download sherpa-onnx binaries
+ run: node scripts/download-sherpa-onnx.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Cache Electron
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/electron
+ key: linux-electron-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: linux-electron-
+
+ - name: Install Linux packaging dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y rpm
+
+ - name: Build Application
+ run: npm run build:linux -- --publish never
+ env:
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
+ VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: linux-build
+ path: dist/
+ retention-days: 7
build-windows:
runs-on: windows-latest
steps:
- - uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Install dependencies
- run: npm ci
-
- - name: Cache native binaries
- uses: actions/cache@v4
- with:
- path: resources/bin
- key: windows-x64-bin-${{ hashFiles('scripts/download-*.js') }}
-
- - name: Download whisper.cpp binaries
- run: node scripts/download-whisper-cpp.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download llama-server binaries
- run: node scripts/download-llama-server.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download sherpa-onnx binaries
- run: node scripts/download-sherpa-onnx.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download nircmd.exe
- run: node scripts/download-nircmd.js
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Cache Electron
- uses: actions/cache@v4
- with:
- path: ~/AppData/Local/electron/Cache
- key: windows-electron-${{ hashFiles('**/package-lock.json') }}
- restore-keys: windows-electron-
-
- - name: Build Application
- run: npm run build:win -- --publish never
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
- VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
- VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
-
- - name: Upload Artifacts
- uses: actions/upload-artifact@v4
- with:
- name: windows-build
- path: dist/
- retention-days: 7
+ - uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+ cache: "npm"
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Cache native binaries
+ uses: actions/cache@v4
+ with:
+ path: resources/bin
+ key: windows-x64-bin-${{ hashFiles('scripts/download-*.js') }}
+
+ - name: Download whisper.cpp binaries
+ run: node scripts/download-whisper-cpp.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download llama-server binaries
+ run: node scripts/download-llama-server.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download sherpa-onnx binaries
+ run: node scripts/download-sherpa-onnx.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download nircmd.exe
+ run: node scripts/download-nircmd.js
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Cache Electron
+ uses: actions/cache@v4
+ with:
+ path: ~/AppData/Local/electron/Cache
+ key: windows-electron-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: windows-electron-
+
+ - name: Build Application
+ run: npm run build:win -- --publish never
+ env:
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
+ VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: windows-build
+ path: dist/
+ retention-days: 7
build-macos:
runs-on: macos-latest
@@ -147,93 +147,94 @@ jobs:
matrix:
arch: [x64, arm64]
steps:
- - uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Install dependencies
- run: npm ci
-
- - name: Cache native binaries
- uses: actions/cache@v4
- with:
- path: resources/bin
- key: macos-${{ matrix.arch }}-bin-${{ hashFiles('scripts/download-*.js') }}
-
- - name: Download whisper.cpp binaries
- run: node scripts/download-whisper-cpp.js --current --platform darwin --arch ${{ matrix.arch }}
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download llama-server binaries
- run: node scripts/download-llama-server.js --current --platform darwin --arch ${{ matrix.arch }}
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download sherpa-onnx binaries
- run: node scripts/download-sherpa-onnx.js --current --platform darwin --arch ${{ matrix.arch }}
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Cache Electron
- uses: actions/cache@v4
- with:
- path: ~/.cache/electron
- key: macos-${{ matrix.arch }}-electron-${{ hashFiles('**/package-lock.json') }}
- restore-keys: macos-${{ matrix.arch }}-electron-
-
- - name: Setup macOS Code Signing
- if: github.event_name != 'pull_request'
- env:
- APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
- APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
- run: |
- CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
- API_KEY_PATH=$RUNNER_TEMP/api_key.p8
- KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
-
- echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH
- echo "$APPLE_API_KEY_BASE64" | base64 --decode > $API_KEY_PATH
-
- security create-keychain -p "runner" $KEYCHAIN_PATH
- security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
- security unlock-keychain -p "runner" $KEYCHAIN_PATH
-
- security import $CERTIFICATE_PATH -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
- security list-keychain -d user -s $KEYCHAIN_PATH
-
- security set-key-partition-list -S apple-tool:,apple: -s -k "runner" $KEYCHAIN_PATH
-
- echo "APPLE_API_KEY=$API_KEY_PATH" >> $GITHUB_ENV
-
- - name: Build Application (${{ matrix.arch }})
- run: npm run build:mac -- --${{ matrix.arch }} --publish never
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
- VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
- VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
- CSC_IDENTITY_AUTO_DISCOVERY: ${{ github.event_name != 'pull_request' && 'true' || 'false' }}
- CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
- APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
- APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
-
- - name: Upload Artifacts
- uses: actions/upload-artifact@v4
- with:
- name: macos-${{ matrix.arch }}-build
- path: dist/
- retention-days: 7
-
- - name: Cleanup Certificates
- if: always() && github.event_name != 'pull_request'
- run: |
- security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
- rm -f $RUNNER_TEMP/build_certificate.p12
- rm -f $RUNNER_TEMP/api_key.p8
+ - uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+ cache: "npm"
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Cache native binaries
+ uses: actions/cache@v4
+ with:
+ path: resources/bin
+ key: macos-${{ matrix.arch }}-bin-${{ hashFiles('scripts/download-*.js', 'scripts/build-globe-listener.js', 'resources/macos-globe-listener.swift') }}
+
+ - name: Download whisper.cpp binaries
+ run: node scripts/download-whisper-cpp.js --current --platform darwin --arch ${{ matrix.arch }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download llama-server binaries
+ run: node scripts/download-llama-server.js --current --platform darwin --arch ${{ matrix.arch }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download sherpa-onnx binaries
+ run: node scripts/download-sherpa-onnx.js --current --platform darwin --arch ${{ matrix.arch }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Cache Electron
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/electron
+ key: macos-${{ matrix.arch }}-electron-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: macos-${{ matrix.arch }}-electron-
+
+ - name: Setup macOS Code Signing
+ if: github.event_name != 'pull_request'
+ env:
+ APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
+ APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
+ APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
+ run: |
+ CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
+ API_KEY_PATH=$RUNNER_TEMP/api_key.p8
+ KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
+
+ echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH
+ echo "$APPLE_API_KEY_BASE64" | base64 --decode > $API_KEY_PATH
+
+ security create-keychain -p "runner" $KEYCHAIN_PATH
+ security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
+ security unlock-keychain -p "runner" $KEYCHAIN_PATH
+
+ security import $CERTIFICATE_PATH -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
+ security list-keychain -d user -s $KEYCHAIN_PATH
+
+ security set-key-partition-list -S apple-tool:,apple: -s -k "runner" $KEYCHAIN_PATH
+
+ echo "APPLE_API_KEY=$API_KEY_PATH" >> $GITHUB_ENV
+
+ - name: Build Application (${{ matrix.arch }})
+ run: npm run build:mac -- --${{ matrix.arch }} --publish never
+ env:
+ TARGET_ARCH: ${{ matrix.arch }}
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
+ VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
+ CSC_IDENTITY_AUTO_DISCOVERY: ${{ github.event_name != 'pull_request' && 'true' || 'false' }}
+ CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
+
+ - name: Upload Artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: macos-${{ matrix.arch }}-build
+ path: dist/
+ retention-days: 7
+
+ - name: Cleanup Certificates
+ if: always() && github.event_name != 'pull_request'
+ run: |
+ security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
+ rm -f $RUNNER_TEMP/build_certificate.p12
+ rm -f $RUNNER_TEMP/api_key.p8
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 81822a563..e36800ece 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -3,127 +3,127 @@ name: Release
on:
push:
tags:
- - 'v*.*.*' # Triggers on version tags like v1.0.0, v2.1.3, etc.
+ - "v*.*.*" # Triggers on version tags like v1.0.0, v2.1.3, etc.
workflow_dispatch:
inputs:
version:
- description: 'Version to release (e.g., 1.0.0)'
+ description: "Version to release (e.g., 1.0.0)"
required: true
type: string
permissions:
- contents: write # Required for creating releases
+ contents: write # Required for creating releases
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Install dependencies
- run: npm ci
-
- - name: Cache native binaries
- uses: actions/cache@v4
- with:
- path: resources/bin
- key: linux-x64-bin-${{ hashFiles('scripts/download-*.js') }}
-
- - name: Download whisper.cpp binaries
- run: node scripts/download-whisper-cpp.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download llama-server binaries
- run: node scripts/download-llama-server.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download sherpa-onnx binaries
- run: node scripts/download-sherpa-onnx.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Cache Electron
- uses: actions/cache@v4
- with:
- path: ~/.cache/electron
- key: linux-electron-${{ hashFiles('**/package-lock.json') }}
- restore-keys: linux-electron-
-
- - name: Install Linux packaging dependencies
- run: |
- sudo apt-get update
- sudo apt-get install -y rpm
-
- - name: Build Application
- run: npm run build:linux -- --publish always
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
- VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
- VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
+ - uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+ cache: "npm"
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Cache native binaries
+ uses: actions/cache@v4
+ with:
+ path: resources/bin
+ key: linux-x64-bin-${{ hashFiles('scripts/download-*.js') }}
+
+ - name: Download whisper.cpp binaries
+ run: node scripts/download-whisper-cpp.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download llama-server binaries
+ run: node scripts/download-llama-server.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download sherpa-onnx binaries
+ run: node scripts/download-sherpa-onnx.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Cache Electron
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/electron
+ key: linux-electron-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: linux-electron-
+
+ - name: Install Linux packaging dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y rpm
+
+ - name: Build Application
+ run: npm run build:linux -- --publish always
+ env:
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
+ VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
build-windows:
runs-on: windows-latest
steps:
- - uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Install dependencies
- run: npm ci
-
- - name: Cache native binaries
- uses: actions/cache@v4
- with:
- path: resources/bin
- key: windows-x64-bin-${{ hashFiles('scripts/download-*.js') }}
-
- - name: Download whisper.cpp binaries
- run: node scripts/download-whisper-cpp.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download llama-server binaries
- run: node scripts/download-llama-server.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download sherpa-onnx binaries
- run: node scripts/download-sherpa-onnx.js --current
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download nircmd.exe
- run: node scripts/download-nircmd.js
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Cache Electron
- uses: actions/cache@v4
- with:
- path: ~/AppData/Local/electron/Cache
- key: windows-electron-${{ hashFiles('**/package-lock.json') }}
- restore-keys: windows-electron-
-
- - name: Build Application
- run: npm run build:win -- --publish always
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
- VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
- VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
+ - uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+ cache: "npm"
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Cache native binaries
+ uses: actions/cache@v4
+ with:
+ path: resources/bin
+ key: windows-x64-bin-${{ hashFiles('scripts/download-*.js') }}
+
+ - name: Download whisper.cpp binaries
+ run: node scripts/download-whisper-cpp.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download llama-server binaries
+ run: node scripts/download-llama-server.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download sherpa-onnx binaries
+ run: node scripts/download-sherpa-onnx.js --current
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download nircmd.exe
+ run: node scripts/download-nircmd.js
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Cache Electron
+ uses: actions/cache@v4
+ with:
+ path: ~/AppData/Local/electron/Cache
+ key: windows-electron-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: windows-electron-
+
+ - name: Build Application
+ run: npm run build:win -- --publish always
+ env:
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
+ VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
build-macos:
runs-on: macos-latest
@@ -132,85 +132,86 @@ jobs:
matrix:
arch: [x64, arm64]
steps:
- - uses: actions/checkout@v4
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- cache: 'npm'
-
- - name: Install dependencies
- run: npm ci
-
- - name: Cache native binaries
- uses: actions/cache@v4
- with:
- path: resources/bin
- key: macos-${{ matrix.arch }}-bin-${{ hashFiles('scripts/download-*.js') }}
-
- - name: Download whisper.cpp binaries
- run: node scripts/download-whisper-cpp.js --current --platform darwin --arch ${{ matrix.arch }}
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download llama-server binaries
- run: node scripts/download-llama-server.js --current --platform darwin --arch ${{ matrix.arch }}
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Download sherpa-onnx binaries
- run: node scripts/download-sherpa-onnx.js --current --platform darwin --arch ${{ matrix.arch }}
- env:
- GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
-
- - name: Cache Electron
- uses: actions/cache@v4
- with:
- path: ~/.cache/electron
- key: macos-${{ matrix.arch }}-electron-${{ hashFiles('**/package-lock.json') }}
- restore-keys: macos-${{ matrix.arch }}-electron-
-
- - name: Setup macOS Code Signing
- env:
- APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
- APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
- run: |
- CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
- API_KEY_PATH=$RUNNER_TEMP/api_key.p8
- KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
-
- echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH
- echo "$APPLE_API_KEY_BASE64" | base64 --decode > $API_KEY_PATH
-
- security create-keychain -p "runner" $KEYCHAIN_PATH
- security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
- security unlock-keychain -p "runner" $KEYCHAIN_PATH
-
- security import $CERTIFICATE_PATH -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
- security list-keychain -d user -s $KEYCHAIN_PATH
-
- security set-key-partition-list -S apple-tool:,apple: -s -k "runner" $KEYCHAIN_PATH
-
- echo "APPLE_API_KEY=$API_KEY_PATH" >> $GITHUB_ENV
-
- - name: Build Application (${{ matrix.arch }})
- run: npm run build:mac -- --${{ matrix.arch }} --publish always
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
- VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
- VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
- CSC_IDENTITY_AUTO_DISCOVERY: true
- CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
- APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
- APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
-
- - name: Cleanup Certificates
- if: always()
- run: |
- security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
- rm -f $RUNNER_TEMP/build_certificate.p12
- rm -f $RUNNER_TEMP/api_key.p8
+ - uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+ cache: "npm"
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: Cache native binaries
+ uses: actions/cache@v4
+ with:
+ path: resources/bin
+ key: macos-${{ matrix.arch }}-bin-${{ hashFiles('scripts/download-*.js', 'scripts/build-globe-listener.js', 'resources/macos-globe-listener.swift') }}
+
+ - name: Download whisper.cpp binaries
+ run: node scripts/download-whisper-cpp.js --current --platform darwin --arch ${{ matrix.arch }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download llama-server binaries
+ run: node scripts/download-llama-server.js --current --platform darwin --arch ${{ matrix.arch }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Download sherpa-onnx binaries
+ run: node scripts/download-sherpa-onnx.js --current --platform darwin --arch ${{ matrix.arch }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
+
+ - name: Cache Electron
+ uses: actions/cache@v4
+ with:
+ path: ~/.cache/electron
+ key: macos-${{ matrix.arch }}-electron-${{ hashFiles('**/package-lock.json') }}
+ restore-keys: macos-${{ matrix.arch }}-electron-
+
+ - name: Setup macOS Code Signing
+ env:
+ APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
+ APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
+ APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
+ run: |
+ CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
+ API_KEY_PATH=$RUNNER_TEMP/api_key.p8
+ KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
+
+ echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH
+ echo "$APPLE_API_KEY_BASE64" | base64 --decode > $API_KEY_PATH
+
+ security create-keychain -p "runner" $KEYCHAIN_PATH
+ security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
+ security unlock-keychain -p "runner" $KEYCHAIN_PATH
+
+ security import $CERTIFICATE_PATH -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
+ security list-keychain -d user -s $KEYCHAIN_PATH
+
+ security set-key-partition-list -S apple-tool:,apple: -s -k "runner" $KEYCHAIN_PATH
+
+ echo "APPLE_API_KEY=$API_KEY_PATH" >> $GITHUB_ENV
+
+ - name: Build Application (${{ matrix.arch }})
+ run: npm run build:mac -- --${{ matrix.arch }} --publish always
+ env:
+ TARGET_ARCH: ${{ matrix.arch }}
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
+ VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
+ CSC_IDENTITY_AUTO_DISCOVERY: true
+ CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
+ APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
+ APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
+ APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
+
+ - name: Cleanup Certificates
+ if: always()
+ run: |
+ security delete-keychain $RUNNER_TEMP/app-signing.keychain-db || true
+ rm -f $RUNNER_TEMP/build_certificate.p12
+ rm -f $RUNNER_TEMP/api_key.p8
diff --git a/main.js b/main.js
index c3b6f5d77..c1a163026 100644
--- a/main.js
+++ b/main.js
@@ -210,14 +210,11 @@ function setupProductionPath() {
}
}
-// Initialize all managers - called after app.whenReady()
-function initializeManagers() {
- // Set up PATH before initializing managers
+// Phase 1: Initialize managers + IPC handlers before window content loads
+function initializeCoreManagers() {
setupProductionPath();
- // Now it's safe to call app.getPath() and initialize managers
debugLogger = require("./src/helpers/debugLogger");
- // Ensure file logging is initialized now that app is ready
debugLogger.ensureFileLogging();
environmentManager = new EnvironmentManager();
@@ -227,15 +224,30 @@ function initializeManagers() {
hotkeyManager = windowManager.hotkeyManager;
databaseManager = new DatabaseManager();
clipboardManager = new ClipboardManager();
- clipboardManager.preWarmAccessibility();
whisperManager = new WhisperManager();
parakeetManager = new ParakeetManager();
- trayManager = new TrayManager();
updateManager = new UpdateManager();
- globeKeyManager = new GlobeKeyManager();
windowsKeyManager = new WindowsKeyManager();
- // Set up Globe key error handler on macOS
+ // IPC handlers must be registered before window content loads
+ new IPCHandlers({
+ environmentManager,
+ databaseManager,
+ clipboardManager,
+ whisperManager,
+ parakeetManager,
+ windowManager,
+ updateManager,
+ windowsKeyManager,
+ });
+}
+
+// Phase 2: Non-critical setup after windows are visible
+function initializeDeferredManagers() {
+ clipboardManager.preWarmAccessibility();
+ trayManager = new TrayManager();
+ globeKeyManager = new GlobeKeyManager();
+
if (process.platform === "darwin") {
globeKeyManager.on("error", (error) => {
if (globeKeyAlertShown) {
@@ -264,18 +276,6 @@ function initializeManagers() {
});
});
}
-
- // Initialize IPC handlers with all managers
- const _ipcHandlers = new IPCHandlers({
- environmentManager,
- databaseManager,
- clipboardManager,
- whisperManager,
- parakeetManager,
- windowManager,
- updateManager,
- windowsKeyManager,
- });
}
app.on('open-url', (event, url) => {
@@ -420,12 +420,11 @@ function startAuthBridgeServer() {
// Main application startup
async function startApp() {
- // Initialize all managers now that app is ready
- initializeManagers();
+ // Phase 1: Core managers + IPC handlers before windows
+ initializeCoreManagers();
startAuthBridgeServer();
// Electron's file:// sends no Origin header, which Neon Auth rejects.
- // Inject the request's own origin at the Chromium network layer.
session.defaultSession.webRequest.onBeforeSendHeaders(
{ urls: ["https://*.neon.tech/*"] },
(details, callback) => {
@@ -436,56 +435,56 @@ async function startApp() {
}
);
- // Initialize activation mode cache from persisted .env value
windowManager.setActivationModeCache(environmentManager.getActivationMode());
+ windowManager.setFloatingIconAutoHide(environmentManager.getFloatingIconAutoHide());
- // Update cache + persist when renderer changes activation mode (all platforms)
ipcMain.on("activation-mode-changed", (_event, mode) => {
windowManager.setActivationModeCache(mode);
environmentManager.saveActivationMode(mode);
});
- // In development, add a small delay to let Vite start properly
- if (process.env.NODE_ENV === "development") {
- await new Promise((resolve) => setTimeout(resolve, 2000));
- }
+ ipcMain.on("floating-icon-auto-hide-changed", (_event, enabled) => {
+ windowManager.setFloatingIconAutoHide(enabled);
+ environmentManager.saveFloatingIconAutoHide(enabled);
+ // Relay to the floating icon window so it can react immediately
+ if (windowManager.mainWindow && !windowManager.mainWindow.isDestroyed()) {
+ windowManager.mainWindow.webContents.send("floating-icon-auto-hide-changed", enabled);
+ }
+ });
- // On macOS, set activation policy to allow dock icon to be shown/hidden dynamically
- // The dock icon visibility is managed by WindowManager based on control panel state
if (process.platform === "darwin") {
app.setActivationPolicy("regular");
}
- // Initialize Whisper manager at startup (don't await to avoid blocking)
- // Settings can be provided via environment variables for server pre-warming:
- // - LOCAL_TRANSCRIPTION_PROVIDER=whisper to enable local whisper mode
- // - LOCAL_WHISPER_MODEL=base (or tiny, small, medium, large, turbo)
+ // In development, wait for Vite dev server to be ready
+ if (process.env.NODE_ENV === "development") {
+ await new Promise((resolve) => setTimeout(resolve, 500));
+ }
+
+ // Create windows FIRST so the user sees UI as soon as possible
+ await windowManager.createMainWindow();
+ await windowManager.createControlPanelWindow();
+
+ // Phase 2: Initialize remaining managers after windows are visible
+ initializeDeferredManagers();
+
+ // Non-blocking server pre-warming
const whisperSettings = {
localTranscriptionProvider: process.env.LOCAL_TRANSCRIPTION_PROVIDER || "",
whisperModel: process.env.LOCAL_WHISPER_MODEL,
};
whisperManager.initializeAtStartup(whisperSettings).catch((err) => {
- // Whisper not being available at startup is not critical
debugLogger.debug("Whisper startup init error (non-fatal)", { error: err.message });
});
- // Initialize Parakeet manager at startup (don't await to avoid blocking)
- // Settings can be provided via environment variables for server pre-warming:
- // - LOCAL_TRANSCRIPTION_PROVIDER=nvidia to enable parakeet
- // - PARAKEET_MODEL=parakeet-tdt-0.6b-v3 (model name)
const parakeetSettings = {
localTranscriptionProvider: process.env.LOCAL_TRANSCRIPTION_PROVIDER || "",
parakeetModel: process.env.PARAKEET_MODEL,
};
parakeetManager.initializeAtStartup(parakeetSettings).catch((err) => {
- // Parakeet not being available at startup is not critical
debugLogger.debug("Parakeet startup init error (non-fatal)", { error: err.message });
});
- // Pre-warm llama-server if local reasoning is configured
- // Settings can be provided via environment variables:
- // - REASONING_PROVIDER=local to enable local reasoning
- // - LOCAL_REASONING_MODEL=qwen3-8b-q4_k_m (or another model ID)
if (process.env.REASONING_PROVIDER === "local" && process.env.LOCAL_REASONING_MODEL) {
const modelManager = require("./src/helpers/modelManagerBridge").default;
modelManager.prewarmServer(process.env.LOCAL_REASONING_MODEL).catch((err) => {
@@ -493,25 +492,16 @@ async function startApp() {
});
}
- // Log nircmd status on Windows (for debugging bundled dependencies)
if (process.platform === "win32") {
const nircmdStatus = clipboardManager.getNircmdStatus();
debugLogger.debug("Windows paste tool status", nircmdStatus);
}
- // Create main window
- await windowManager.createMainWindow();
-
- // Create control panel window
- await windowManager.createControlPanelWindow();
-
- // Set up tray
trayManager.setWindows(windowManager.mainWindow, windowManager.controlPanelWindow);
trayManager.setWindowManager(windowManager);
trayManager.setCreateControlPanelCallback(() => windowManager.createControlPanelWindow());
await trayManager.createTray();
- // Set windows for update manager and check for updates
updateManager.setWindows(windowManager.mainWindow, windowManager.controlPanelWindow);
updateManager.checkForUpdatesOnStartup();
diff --git a/preload.js b/preload.js
index 6ffd015cc..aa6bf8d2c 100644
--- a/preload.js
+++ b/preload.js
@@ -301,6 +301,10 @@ contextBridge.exposeInMainWorld("electronAPI", {
notifyActivationModeChanged: (mode) => ipcRenderer.send("activation-mode-changed", mode),
notifyHotkeyChanged: (hotkey) => ipcRenderer.send("hotkey-changed", hotkey),
+ // Floating icon auto-hide
+ notifyFloatingIconAutoHideChanged: (enabled) => ipcRenderer.send("floating-icon-auto-hide-changed", enabled),
+ onFloatingIconAutoHideChanged: registerListener("floating-icon-auto-hide-changed", (callback) => (_event, enabled) => callback(enabled)),
+
// Auto-start management
getAutoStartEnabled: () => ipcRenderer.invoke("get-auto-start-enabled"),
setAutoStartEnabled: (enabled) => ipcRenderer.invoke("set-auto-start-enabled", enabled),
diff --git a/scripts/build-globe-listener.js b/scripts/build-globe-listener.js
index 8662e67ed..a354a4195 100644
--- a/scripts/build-globe-listener.js
+++ b/scripts/build-globe-listener.js
@@ -10,11 +10,26 @@ if (!isMac) {
process.exit(0);
}
+// Support cross-compilation via --arch flag or TARGET_ARCH env var
+const archIndex = process.argv.indexOf("--arch");
+const targetArch =
+ (archIndex !== -1 && process.argv[archIndex + 1]) || process.env.TARGET_ARCH || process.arch;
+
+const ARCH_TO_TARGET = {
+ arm64: "arm64-apple-macosx11.0",
+ x64: "x86_64-apple-macosx10.15",
+};
+const swiftTarget = ARCH_TO_TARGET[targetArch];
+if (!swiftTarget) {
+ console.error(`[globe-listener] Unsupported architecture: ${targetArch}`);
+ process.exit(1);
+}
+
const projectRoot = path.resolve(__dirname, "..");
const swiftSource = path.join(projectRoot, "resources", "macos-globe-listener.swift");
const outputDir = path.join(projectRoot, "resources", "bin");
const outputBinary = path.join(outputDir, "macos-globe-listener");
-const hashFile = path.join(outputDir, ".macos-globe-listener.hash");
+const hashFile = path.join(outputDir, `.macos-globe-listener.${targetArch}.hash`);
const moduleCacheDir = path.join(outputDir, ".swift-module-cache");
function log(message) {
@@ -88,6 +103,8 @@ function attemptCompile(command, args) {
const compileArgs = [
swiftSource,
"-O",
+ "-target",
+ swiftTarget,
"-module-cache-path",
moduleCacheDir,
"-o",
@@ -121,4 +138,4 @@ try {
log(`Warning: Could not save source hash: ${err.message}`);
}
-log("Successfully built macOS Globe listener binary.");
+log(`Successfully built macOS Globe listener binary (${targetArch}).`);
diff --git a/src/App.jsx b/src/App.jsx
index 5d872c445..05e1ea76c 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -81,6 +81,12 @@ export default function App() {
const [dragStartPos, setDragStartPos] = useState(null);
const [hasDragged, setHasDragged] = useState(false);
+ // Floating icon auto-hide setting (read from localStorage, synced via IPC)
+ const [floatingIconAutoHide, setFloatingIconAutoHide] = useState(
+ () => localStorage.getItem("floatingIconAutoHide") === "true"
+ );
+ const prevAutoHideRef = useRef(floatingIconAutoHide);
+
const setWindowInteractivity = React.useCallback((shouldCapture) => {
window.electronAPI?.setMainWindowInteractivity?.(shouldCapture);
}, []);
@@ -159,6 +165,31 @@ export default function App() {
}
}, [isSignedIn]);
+ // Listen for auto-hide setting changes relayed from the main process
+ useEffect(() => {
+ const unsubscribe = window.electronAPI?.onFloatingIconAutoHideChanged?.((enabled) => {
+ setFloatingIconAutoHide(enabled);
+ });
+ return () => unsubscribe?.();
+ }, []);
+
+ // Auto-hide the floating icon when idle (setting enabled or dictation cycle completed)
+ useEffect(() => {
+ let hideTimeout;
+
+ if (floatingIconAutoHide && !isRecording && !isProcessing && toastCount === 0) {
+ // Delay briefly so processing can start after recording stops without a flash
+ hideTimeout = setTimeout(() => {
+ window.electronAPI?.hideWindow?.();
+ }, 500);
+ } else if (!floatingIconAutoHide && prevAutoHideRef.current) {
+ window.electronAPI?.showDictationPanel?.();
+ }
+
+ prevAutoHideRef.current = floatingIconAutoHide;
+ return () => clearTimeout(hideTimeout);
+ }, [isRecording, isProcessing, floatingIconAutoHide, toastCount]);
+
const handleClose = () => {
window.electronAPI.hideWindow();
};
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 4c0c9f958..2fe2ca4e3 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -1,4 +1,4 @@
-import { useState, useEffect, useRef } from "react";
+import React, { Suspense, useState, useEffect, useRef, useCallback } from "react";
import { Button } from "./ui/button";
import {
Trash2,
@@ -12,7 +12,7 @@ import {
Cloud,
X,
} from "lucide-react";
-import SettingsModal, { SettingsSectionType } from "./SettingsModal";
+import type { SettingsSectionType } from "./SettingsModal";
import TitleBar from "./TitleBar";
import SupportDropdown from "./ui/SupportDropdown";
import TranscriptionItem from "./ui/TranscriptionItem";
@@ -32,6 +32,8 @@ import {
} from "../stores/transcriptionStore";
import { formatHotkeyLabel } from "../utils/hotkeys";
+const SettingsModal = React.lazy(() => import("./SettingsModal"));
+
export default function ControlPanel() {
const history = useTranscriptions();
const [isLoading, setIsLoading] = useState(true);
@@ -142,25 +144,28 @@ export default function ControlPanel() {
}
};
- const copyToClipboard = async (text: string) => {
- try {
- await navigator.clipboard.writeText(text);
- toast({
- title: "Copied!",
- description: "Text copied to your clipboard",
- variant: "success",
- duration: 2000,
- });
- } catch (err) {
- toast({
- title: "Copy Failed",
- description: "Failed to copy text to clipboard",
- variant: "destructive",
- });
- }
- };
+ const copyToClipboard = useCallback(
+ async (text: string) => {
+ try {
+ await navigator.clipboard.writeText(text);
+ toast({
+ title: "Copied!",
+ description: "Text copied to your clipboard",
+ variant: "success",
+ duration: 2000,
+ });
+ } catch (err) {
+ toast({
+ title: "Copy Failed",
+ description: "Failed to copy text to clipboard",
+ variant: "destructive",
+ });
+ }
+ },
+ [toast]
+ );
- const clearHistory = async () => {
+ const clearHistory = useCallback(async () => {
showConfirmDialog({
title: "Clear History",
description: "Are you sure you want to clear all transcriptions? This cannot be undone.",
@@ -184,33 +189,36 @@ export default function ControlPanel() {
},
variant: "destructive",
});
- };
+ }, [showConfirmDialog, toast]);
- const deleteTranscription = async (id: number) => {
- showConfirmDialog({
- title: "Delete Transcription",
- description: "Are you certain you wish to remove this inscription from your records?",
- onConfirm: async () => {
- try {
- const result = await window.electronAPI.deleteTranscription(id);
- if (result.success) {
- removeFromStore(id);
- } else {
+ const deleteTranscription = useCallback(
+ async (id: number) => {
+ showConfirmDialog({
+ title: "Delete Transcription",
+ description: "Are you certain you wish to remove this inscription from your records?",
+ onConfirm: async () => {
+ try {
+ const result = await window.electronAPI.deleteTranscription(id);
+ if (result.success) {
+ removeFromStore(id);
+ } else {
+ showAlertDialog({
+ title: "Delete Failed",
+ description: "Failed to delete transcription. It may have already been removed.",
+ });
+ }
+ } catch (error) {
showAlertDialog({
title: "Delete Failed",
- description: "Failed to delete transcription. It may have already been removed.",
+ description: "Failed to delete transcription. Please try again.",
});
}
- } catch (error) {
- showAlertDialog({
- title: "Delete Failed",
- description: "Failed to delete transcription. Please try again.",
- });
- }
- },
- variant: "destructive",
- });
- };
+ },
+ variant: "destructive",
+ });
+ },
+ [showConfirmDialog, showAlertDialog]
+ );
const handleUpdateClick = async () => {
if (updateStatus.updateDownloaded) {
@@ -339,14 +347,18 @@ export default function ControlPanel() {
}
/>
- <SettingsModal
- open={showSettings}
- onOpenChange={(open) => {
- setShowSettings(open);
- if (!open) setSettingsSection(undefined);
- }}
- initialSection={settingsSection}
- />
+ {showSettings && (
+ <Suspense fallback={null}>
+ <SettingsModal
+ open={showSettings}
+ onOpenChange={(open) => {
+ setShowSettings(open);
+ if (!open) setSettingsSection(undefined);
+ }}
+ initialSection={settingsSection}
+ />
+ </Suspense>
+ )}
<div className="p-4">
<div className="max-w-3xl mx-auto">
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index bb87efc27..2d398b3e2 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -641,6 +641,10 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
setCloudTranscriptionMode,
cloudReasoningMode,
setCloudReasoningMode,
+ audioCuesEnabled,
+ setAudioCuesEnabled,
+ floatingIconAutoHide,
+ setFloatingIconAutoHide,
cloudBackupEnabled,
setCloudBackupEnabled,
telemetryEnabled,
@@ -1354,6 +1358,39 @@ export default function SettingsPage({ activeSection = "general" }: SettingsPage
</SettingsPanel>
</div>
+ {/* Sound Effects */}
+ <div>
+ <SectionHeader title="Sound Effects" />
+ <SettingsPanel>
+ <SettingsPanelRow>
+ <SettingsRow
+ label="Dictation sounds"
+ description="Play a tone when recording starts and stops"
+ >
+ <Toggle checked={audioCuesEnabled} onChange={setAudioCuesEnabled} />
+ </SettingsRow>
+ </SettingsPanelRow>
+ </SettingsPanel>
+ </div>
+
+ {/* Floating Icon */}
+ <div>
+ <SectionHeader
+ title="Floating Icon"
+ description="Control when the dictation icon is visible on your screen"
+ />
+ <SettingsPanel>
+ <SettingsPanelRow>
+ <SettingsRow
+ label="Auto-hide when idle"
+ description="Keep the icon hidden until you start dictating"
+ >
+ <Toggle checked={floatingIconAutoHide} onChange={setFloatingIconAutoHide} />
+ </SettingsRow>
+ </SettingsPanelRow>
+ </SettingsPanel>
+ </div>
+
{/* Language */}
<div>
<SectionHeader
diff --git a/src/components/ui/SupportDropdown.tsx b/src/components/ui/SupportDropdown.tsx
index 0d055ecea..b1d3c8d59 100644
--- a/src/components/ui/SupportDropdown.tsx
+++ b/src/components/ui/SupportDropdown.tsx
@@ -9,39 +9,30 @@ import {
} from "./dropdown-menu";
import { cn } from "../lib/utils";
+function DiscordIcon({ className }: { className?: string }) {
+ return (
+ <svg viewBox="0 0 24 24" fill="currentColor" className={className}>
+ <path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.095 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z" />
+ </svg>
+ );
+}
+
interface SupportDropdownProps {
className?: string;
}
-export default function SupportDropdown({ className }: SupportDropdownProps) {
- const handleContactSupport = async () => {
- try {
- const result = await window.electronAPI?.openExternal("mailto:[email protected]");
- if (!result?.success) {
- console.error("Failed to open email client:", result?.error);
- // Fallback: try opening the email as a web URL
- await window.electronAPI?.openExternal(
- "https://mail.google.com/mail/?view=cm&[email protected]"
- );
- }
- } catch (error) {
- console.error("Error opening email client:", error);
+const openExternal = async (url: string) => {
+ try {
+ const result = await window.electronAPI?.openExternal(url);
+ if (!result?.success) {
+ console.error("Failed to open URL:", result?.error);
}
- };
-
- const handleSubmitBug = async () => {
- try {
- const result = await window.electronAPI?.openExternal(
- "https://github.com/OpenWhispr/openwhispr/issues"
- );
- if (!result?.success) {
- console.error("Failed to open GitHub issues:", result?.error);
- }
- } catch (error) {
- console.error("Error opening GitHub issues:", error);
- }
- };
+ } catch (error) {
+ console.error("Error opening URL:", error);
+ }
+};
+export default function SupportDropdown({ className }: SupportDropdownProps) {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -56,17 +47,24 @@ export default function SupportDropdown({ className }: SupportDropdownProps) {
<HelpCircle size={16} />
</Button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="bg-popover border border-border shadow-lg">
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => openExternal("https://discord.gg/yZWC9WTtX7")}>
+ <DiscordIcon className="mr-2 h-4 w-4" />
+ Join Discord
+ </DropdownMenuItem>
<DropdownMenuItem
- onClick={handleContactSupport}
- className="cursor-pointer hover:bg-muted focus:bg-muted"
+ onClick={async () => {
+ const result = await window.electronAPI?.openExternal("mailto:[email protected]");
+ if (!result?.success) {
+ openExternal("https://mail.google.com/mail/?view=cm&[email protected]");
+ }
+ }}
>
<Mail className="mr-2 h-4 w-4" />
Contact Support
</DropdownMenuItem>
<DropdownMenuItem
- onClick={handleSubmitBug}
- className="cursor-pointer hover:bg-muted focus:bg-muted"
+ onClick={() => openExternal("https://github.com/OpenWhispr/openwhispr/issues")}
>
<Bug className="mr-2 h-4 w-4" />
Submit Bug
diff --git a/src/components/ui/Toast.tsx b/src/components/ui/Toast.tsx
index bff026691..d856cfafa 100644
--- a/src/components/ui/Toast.tsx
+++ b/src/components/ui/Toast.tsx
@@ -1,5 +1,5 @@
import * as React from "react";
-import { X, CheckCircle2, AlertCircle, Info } from "lucide-react";
+import { X, Copy, Check } from "lucide-react";
import { cn } from "../lib/utils";
export interface ToastProps {
@@ -60,7 +60,7 @@ export const ToastProvider: React.FC<{ children: React.ReactNode }> = ({ childre
setToasts((prev) => [...prev, newToast]);
- const duration = props.duration ?? 3500;
+ const duration = props.duration ?? (props.variant === "destructive" ? 6000 : 3500);
if (duration > 0) {
const timer = setTimeout(() => {
startExitAnimation(id);
@@ -149,9 +149,7 @@ const ToastViewport: React.FC<{
<div
className={cn(
"fixed z-50 flex flex-col gap-1.5 pointer-events-none",
- isDictationPanel
- ? "bottom-20 right-6" // Above mic button in dictation panel
- : "bottom-5 right-5" // Standard position in control panel
+ isDictationPanel ? "bottom-20 right-6" : "bottom-5 right-5"
)}
>
{toasts.map((toast) => (
@@ -169,43 +167,16 @@ const ToastViewport: React.FC<{
const variantConfig = {
default: {
- icon: Info,
- containerClass: cn(
- "bg-card/90 dark:bg-surface-2/95",
- "border border-border/60 dark:border-white/10",
- "shadow-[inset_0_1px_0_0_rgba(255,255,255,0.06),0_4px_12px_-2px_rgba(0,0,0,0.15),0_2px_4px_-1px_rgba(0,0,0,0.1)]",
- "dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.05),0_8px_24px_-4px_rgba(0,0,0,0.4),0_2px_8px_-2px_rgba(0,0,0,0.3)]"
- ),
- iconClass: "text-muted-foreground",
- titleClass: "text-card-foreground",
- descClass: "text-muted-foreground",
- progressClass: "bg-muted-foreground/30",
+ accentClass: "bg-white/20",
+ progressClass: "bg-white/15",
},
destructive: {
- icon: AlertCircle,
- containerClass: cn(
- "bg-destructive/8 dark:bg-destructive/12",
- "border border-destructive/20 dark:border-destructive/25",
- "shadow-[inset_0_1px_0_0_rgba(255,255,255,0.04),0_4px_12px_-2px_rgba(220,38,38,0.15),0_2px_4px_-1px_rgba(0,0,0,0.1)]",
- "dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.03),0_8px_24px_-4px_rgba(220,38,38,0.25),0_2px_8px_-2px_rgba(0,0,0,0.3)]"
- ),
- iconClass: "text-destructive",
- titleClass: "text-destructive dark:text-red-400",
- descClass: "text-destructive/80 dark:text-red-400/80",
- progressClass: "bg-destructive/40",
+ accentClass: "bg-red-400",
+ progressClass: "bg-red-400/30",
},
success: {
- icon: CheckCircle2,
- containerClass: cn(
- "bg-success/8 dark:bg-success/12",
- "border border-success/20 dark:border-success/25",
- "shadow-[inset_0_1px_0_0_rgba(255,255,255,0.04),0_4px_12px_-2px_rgba(22,163,74,0.15),0_2px_4px_-1px_rgba(0,0,0,0.1)]",
- "dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.03),0_8px_24px_-4px_rgba(22,163,74,0.25),0_2px_8px_-2px_rgba(0,0,0,0.3)]"
- ),
- iconClass: "text-success",
- titleClass: "text-success dark:text-emerald-400",
- descClass: "text-success/80 dark:text-emerald-400/80",
- progressClass: "bg-success/40",
+ accentClass: "bg-emerald-400",
+ progressClass: "bg-emerald-400/30",
},
};
@@ -228,8 +199,9 @@ const Toast: React.FC<
onResumeTimer,
}) => {
const config = variantConfig[variant];
- const Icon = config.icon;
const pausedAtRef = React.useRef<number | null>(null);
+ const [copied, setCopied] = React.useState(false);
+ const isDestructive = variant === "destructive";
const handleMouseEnter = () => {
pausedAtRef.current = Date.now();
@@ -245,58 +217,91 @@ const Toast: React.FC<
pausedAtRef.current = null;
};
+ const handleCopyError = async () => {
+ if (!description) return;
+ try {
+ await navigator.clipboard.writeText(description);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ } catch {
+ // Silently fail
+ }
+ };
+
+ const message = title || description;
+ const detail = title && description ? description : undefined;
+
return (
<div
className={cn(
- "pointer-events-auto relative flex items-start gap-2.5 w-[320px]",
- "px-3 py-2.5 pr-8 overflow-hidden",
- "rounded-[6px]",
- "backdrop-blur-xl",
+ "group toast-surface pointer-events-auto relative flex w-75 overflow-hidden",
+ "rounded-[5px]",
"transition-all duration-200 ease-out",
isExiting
? "opacity-0 translate-x-2 scale-[0.98]"
- : "opacity-100 translate-x-0 scale-100 animate-in slide-in-from-right-4 fade-in-0 duration-300",
- config.containerClass
+ : "opacity-100 translate-x-0 scale-100 animate-in slide-in-from-right-4 fade-in-0 duration-300"
)}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
>
- <Icon className={cn("size-4 shrink-0 mt-0.5", config.iconClass)} />
-
- <div className="flex-1 min-w-0">
- {title && (
- <div className={cn("text-[13px] font-medium leading-tight", config.titleClass)}>
- {title}
- </div>
- )}
- {description && (
- <div className={cn("text-[12px] leading-snug mt-0.5", config.descClass)}>
- {description}
- </div>
- )}
- </div>
+ <div className={cn("w-0.5 shrink-0", config.accentClass)} />
- {action && <div className="shrink-0 self-center">{action}</div>}
+ <div className="flex items-start gap-2 flex-1 min-w-0 px-2.5 py-2 pr-7">
+ <div className="flex-1 min-w-0">
+ {message && (
+ <div className="text-[12px] font-medium leading-tight text-white/90">{message}</div>
+ )}
+ {detail &&
+ (isDestructive ? (
+ <div
+ className={cn(
+ "text-[11px] leading-snug mt-1 px-1.5 py-1 rounded-[3px] font-mono",
+ "bg-white/4 border border-white/6",
+ "text-red-300/80"
+ )}
+ >
+ <div className="flex items-start justify-between gap-1.5">
+ <span className="select-all wrap-break-word min-w-0">{detail}</span>
+ <button
+ onClick={handleCopyError}
+ className={cn(
+ "shrink-0 p-0.5 rounded-xs mt-px",
+ "text-white/30 hover:text-white/70",
+ "hover:bg-white/6",
+ "transition-all duration-150"
+ )}
+ aria-label="Copy error"
+ >
+ {copied ? <Check className="size-3" /> : <Copy className="size-3" />}
+ </button>
+ </div>
+ </div>
+ ) : (
+ <div className="text-[11px] leading-snug mt-0.5 text-white/45">{detail}</div>
+ ))}
+ </div>
+
+ {action && <div className="shrink-0 self-center">{action}</div>}
+ </div>
{onClose && (
<button
onClick={onClose}
className={cn(
- "absolute right-1.5 top-1.5 p-1 rounded-[4px]",
- "opacity-50 hover:opacity-100",
- "hover:bg-foreground/5 dark:hover:bg-white/10",
+ "absolute right-1 top-1 p-1 rounded-[3px]",
+ "text-white/0 group-hover:text-white/50 hover:!text-white/80",
+ "hover:bg-white/6",
"transition-all duration-150",
- "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/40",
- config.iconClass
+ "focus:outline-none focus-visible:ring-1 focus-visible:ring-white/20"
)}
>
- <X className="size-3.5" />
+ <X className="size-3" />
<span className="sr-only">Close</span>
</button>
)}
{duration > 0 && !isExiting && (
- <div className="absolute bottom-0 left-0 right-0 h-[2px] overflow-hidden">
+ <div className="absolute bottom-0 left-0.5 right-0 h-px overflow-hidden">
<div
className={cn("h-full", config.progressClass)}
style={{
@@ -311,17 +316,15 @@ const Toast: React.FC<
export const toast = {
success: (message: string) => ({
- title: "Success",
- description: message,
+ title: message,
variant: "success" as const,
}),
error: (message: string) => ({
- title: "Error",
- description: message,
+ title: message,
variant: "destructive" as const,
}),
info: (message: string) => ({
- description: message,
+ title: message,
variant: "default" as const,
}),
};
diff --git a/src/components/ui/dropdown-menu.tsx b/src/components/ui/dropdown-menu.tsx
index db28e9afb..df6fe9bf6 100644
--- a/src/components/ui/dropdown-menu.tsx
+++ b/src/components/ui/dropdown-menu.tsx
@@ -61,7 +61,7 @@ const DropdownMenuContent = React.forwardRef<
ref={ref}
sideOffset={sideOffset}
className={cn(
- "z-50 min-w-[8rem] overflow-hidden rounded-xl border border-neutral-200 bg-white p-1.5 text-neutral-900 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
+ "z-50 min-w-[8rem] overflow-hidden rounded-xl border border-border bg-popover p-1.5 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)}
{...props}
@@ -79,7 +79,7 @@ const DropdownMenuItem = React.forwardRef<
<DropdownMenuPrimitive.Item
ref={ref}
className={cn(
- "relative flex cursor-pointer select-none items-center rounded-lg px-2.5 py-2 text-sm outline-none transition-colors focus:bg-neutral-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
+ "relative flex cursor-pointer select-none items-center rounded-lg px-2.5 py-2 text-sm outline-none transition-colors focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
inset && "pl-8",
className
)}
@@ -153,7 +153,7 @@ const DropdownMenuSeparator = React.forwardRef<
>(({ className, ...props }, ref) => (
<DropdownMenuPrimitive.Separator
ref={ref}
- className={cn("-mx-1 my-1 h-px bg-neutral-200", className)}
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
{...props}
/>
));
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index 367756e99..289a8cf5e 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -2215,10 +2215,10 @@ registerProcessor("pcm-streaming-processor", PCMStreamingProcessor);
this.persistentAudioContext.close().catch(() => {});
this.persistentAudioContext = null;
this.workletModuleLoaded = false;
- if (this.workletBlobUrl) {
- URL.revokeObjectURL(this.workletBlobUrl);
- this.workletBlobUrl = null;
- }
+ }
+ if (this.workletBlobUrl) {
+ URL.revokeObjectURL(this.workletBlobUrl);
+ this.workletBlobUrl = null;
}
try {
window.electronAPI?.assemblyAiStreamingStop?.();
diff --git a/src/helpers/environment.js b/src/helpers/environment.js
index 6da6610a4..221b78ebd 100644
--- a/src/helpers/environment.js
+++ b/src/helpers/environment.js
@@ -1,5 +1,6 @@
const path = require("path");
const fs = require("fs");
+const fsPromises = require("fs/promises");
const { app } = require("electron");
const PERSISTED_KEYS = [
@@ -17,6 +18,7 @@ const PERSISTED_KEYS = [
"LOCAL_REASONING_MODEL",
"DICTATION_KEY",
"ACTIVATION_MODE",
+ "FLOATING_ICON_AUTO_HIDE",
];
class EnvironmentManager {
@@ -25,21 +27,27 @@ class EnvironmentManager {
}
loadEnvironmentVariables() {
- // Loaded in priority order — dotenv won't override, so first file wins per variable
- const possibleEnvPaths = [
- path.join(app.getPath("userData"), ".env"),
+ // Loaded in priority order - dotenv won't override, so first file wins per variable.
+ const userDataEnv = path.join(app.getPath("userData"), ".env");
+ try {
+ if (fs.existsSync(userDataEnv)) {
+ require("dotenv").config({ path: userDataEnv });
+ }
+ } catch {}
+
+ const fallbackPaths = [
path.join(__dirname, "..", "..", ".env"), // Development
path.join(process.resourcesPath, ".env"),
path.join(process.resourcesPath, "app.asar.unpacked", ".env"),
path.join(process.resourcesPath, "app", ".env"), // Legacy
];
- for (const envPath of possibleEnvPaths) {
+ for (const envPath of fallbackPaths) {
try {
if (fs.existsSync(envPath)) {
require("dotenv").config({ path: envPath });
}
- } catch (error) {}
+ } catch {}
}
}
@@ -114,7 +122,7 @@ class EnvironmentManager {
saveDictationKey(key) {
const result = this._saveKey("DICTATION_KEY", key);
- this.saveAllKeysToEnvFile();
+ this.saveAllKeysToEnvFile().catch(() => {});
return result;
}
@@ -126,11 +134,21 @@ class EnvironmentManager {
saveActivationMode(mode) {
const validMode = mode === "push" ? "push" : "tap";
const result = this._saveKey("ACTIVATION_MODE", validMode);
- this.saveAllKeysToEnvFile();
+ this.saveAllKeysToEnvFile().catch(() => {});
+ return result;
+ }
+
+ getFloatingIconAutoHide() {
+ return this._getKey("FLOATING_ICON_AUTO_HIDE") === "true";
+ }
+
+ saveFloatingIconAutoHide(enabled) {
+ const result = this._saveKey("FLOATING_ICON_AUTO_HIDE", String(enabled));
+ this.saveAllKeysToEnvFile().catch(() => {});
return result;
}
- createProductionEnvFile(apiKey) {
+ async createProductionEnvFile(apiKey) {
const envPath = path.join(app.getPath("userData"), ".env");
const envContent = `# OpenWhispr Environment Variables
@@ -138,13 +156,13 @@ class EnvironmentManager {
OPENAI_API_KEY=${apiKey}
`;
- fs.writeFileSync(envPath, envContent, "utf8");
+ await fsPromises.writeFile(envPath, envContent, "utf8");
require("dotenv").config({ path: envPath });
return { success: true, path: envPath };
}
- saveAllKeysToEnvFile() {
+ async saveAllKeysToEnvFile() {
const envPath = path.join(app.getPath("userData"), ".env");
let envContent = "# OpenWhispr Environment Variables\n";
@@ -155,7 +173,7 @@ OPENAI_API_KEY=${apiKey}
}
}
- fs.writeFileSync(envPath, envContent, "utf8");
+ await fsPromises.writeFile(envPath, envContent, "utf8");
require("dotenv").config({ path: envPath });
return { success: true, path: envPath };
diff --git a/src/helpers/hotkeyManager.js b/src/helpers/hotkeyManager.js
index 9a23f82d5..0e4577f84 100644
--- a/src/helpers/hotkeyManager.js
+++ b/src/helpers/hotkeyManager.js
@@ -347,12 +347,12 @@ class HotkeyManager {
localStorage.getItem("dictationKey") || ""
`);
- // If we found a hotkey in localStorage but not in env, migrate it
+ // If we found a hotkey in localStorage but not in env, migrate it to .env file
if (savedHotkey && savedHotkey.trim() !== "") {
- process.env.DICTATION_KEY = savedHotkey;
debugLogger.log(
- `[HotkeyManager] Migrated hotkey "${savedHotkey}" from localStorage to env`
+ `[HotkeyManager] Migrating hotkey "${savedHotkey}" from localStorage to .env`
);
+ await this._persistHotkeyToEnvFile(savedHotkey);
}
}
@@ -371,6 +371,7 @@ class HotkeyManager {
if (defaultHotkey === "GLOBE") {
this.currentHotkey = "GLOBE";
debugLogger.log("[HotkeyManager] Using GLOBE key as default on macOS");
+ await this._persistHotkeyToEnvFile("GLOBE");
return;
}
@@ -405,23 +406,22 @@ class HotkeyManager {
}
}
- async saveHotkeyToRenderer(hotkey) {
- // Escape the hotkey string to prevent injection issues
- const escapedHotkey = hotkey.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
-
- // Save to environment variable for file-based persistence (more reliable)
+ async _persistHotkeyToEnvFile(hotkey) {
process.env.DICTATION_KEY = hotkey;
-
- // Persist to .env file for reliable startup
try {
- // Lazy require to avoid circular dependencies
const EnvironmentManager = require("./environment");
const envManager = new EnvironmentManager();
- envManager.saveAllKeysToEnvFile();
- debugLogger.log(`[HotkeyManager] Saved hotkey "${hotkey}" to .env file`);
+ await envManager.saveAllKeysToEnvFile();
+ debugLogger.log(`[HotkeyManager] Persisted hotkey "${hotkey}" to .env file`);
} catch (err) {
debugLogger.warn("[HotkeyManager] Failed to persist hotkey to .env file:", err.message);
}
+ }
+
+ async saveHotkeyToRenderer(hotkey) {
+ const escapedHotkey = hotkey.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
+
+ await this._persistHotkeyToEnvFile(hotkey);
// Also save to localStorage for backwards compatibility
if (this.mainWindow && !this.mainWindow.isDestroyed()) {
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 9042db4eb..a90a03aa1 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -44,7 +44,7 @@ class IPCHandlers {
set: Object.keys(setVars),
cleared: clearVars.filter((k) => !process.env[k]),
});
- this.environmentManager.saveAllKeysToEnvFile();
+ this.environmentManager.saveAllKeysToEnvFile().catch(() => {});
}
}
@@ -406,7 +406,7 @@ class IPCHandlers {
const result = await this.parakeetManager.startServer(modelName);
process.env.LOCAL_TRANSCRIPTION_PROVIDER = "nvidia";
process.env.PARAKEET_MODEL = modelName;
- this.environmentManager.saveAllKeysToEnvFile();
+ await this.environmentManager.saveAllKeysToEnvFile();
return result;
});
@@ -414,7 +414,7 @@ class IPCHandlers {
const result = await this.parakeetManager.stopServer();
delete process.env.LOCAL_TRANSCRIPTION_PROVIDER;
delete process.env.PARAKEET_MODEL;
- this.environmentManager.saveAllKeysToEnvFile();
+ await this.environmentManager.saveAllKeysToEnvFile();
return result;
});
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index 5ebade01a..54b70ed79 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -24,6 +24,7 @@ class WindowManager {
this.windowsPushToTalkAvailable = false;
this.macCompoundPushState = null;
this._cachedActivationMode = "tap";
+ this._floatingIconAutoHide = false;
app.on("before-quit", () => {
this.isQuitting = true;
@@ -360,6 +361,10 @@ class WindowManager {
this._cachedActivationMode = mode === "push" ? "push" : "tap";
}
+ setFloatingIconAutoHide(enabled) {
+ this._floatingIconAutoHide = Boolean(enabled);
+ }
+
setHotkeyListeningMode(enabled) {
this.hotkeyManager.setListeningMode(enabled);
}
@@ -567,7 +572,12 @@ class WindowManager {
// Safety timeout: force show the window if ready-to-show doesn't fire within 10 seconds
const showTimeout = setTimeout(() => {
- if (this.mainWindow && !this.mainWindow.isDestroyed() && !this.mainWindow.isVisible()) {
+ if (
+ this.mainWindow &&
+ !this.mainWindow.isDestroyed() &&
+ !this.mainWindow.isVisible() &&
+ !this._floatingIconAutoHide
+ ) {
this.mainWindow.show();
}
}, 10000);
@@ -575,7 +585,7 @@ class WindowManager {
this.mainWindow.once("ready-to-show", () => {
clearTimeout(showTimeout);
this.enforceMainWindowOnTop();
- if (!this.mainWindow.isVisible()) {
+ if (!this.mainWindow.isVisible() && !this._floatingIconAutoHide) {
if (typeof this.mainWindow.showInactive === "function") {
this.mainWindow.showInactive();
} else {
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index 98729c968..d2d7d1b09 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -1,11 +1,18 @@
-import { useCallback, useEffect, useRef } from "react";
+import React, { createContext, useCallback, useContext, useEffect, useRef } from "react";
import { useLocalStorage } from "./useLocalStorage";
import { useDebouncedCallback } from "./useDebouncedCallback";
import { API_ENDPOINTS } from "../config/constants";
-import ReasoningService from "../services/ReasoningService";
import logger from "../utils/logger";
import type { LocalTranscriptionProvider } from "../types/electron";
+let _ReasoningService: typeof import("../services/ReasoningService").default | null = null;
+function getReasoningService() {
+ if (!_ReasoningService) {
+ _ReasoningService = require("../services/ReasoningService").default;
+ }
+ return _ReasoningService!;
+}
+
export interface TranscriptionSettings {
useLocalWhisper: boolean;
whisperModel: string;
@@ -60,7 +67,7 @@ export interface ThemeSettings {
theme: "light" | "dark" | "auto";
}
-export function useSettings() {
+function useSettingsInternal() {
const [useLocalWhisper, setUseLocalWhisper] = useLocalStorage("useLocalWhisper", false, {
serialize: String,
deserialize: (value) => value === "true",
@@ -383,7 +390,7 @@ export function useSettings() {
const invalidateApiKeyCaches = useCallback(
(provider?: "openai" | "anthropic" | "gemini" | "groq" | "mistral" | "custom") => {
if (provider) {
- ReasoningService.clearApiKeyCache(provider);
+ getReasoningService().clearApiKeyCache(provider);
}
window.dispatchEvent(new Event("api-key-changed"));
debouncedPersistToEnv();
@@ -508,6 +515,48 @@ export function useSettings() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
+ // Sync dictation key from main process on first mount (handles localStorage cleared)
+ const hasRunDictationKeySync = useRef(false);
+ useEffect(() => {
+ if (hasRunDictationKeySync.current) return;
+ hasRunDictationKeySync.current = true;
+
+ const sync = async () => {
+ if (!window.electronAPI?.getDictationKey) return;
+ const envKey = await window.electronAPI.getDictationKey();
+ if (envKey && envKey !== dictationKey) {
+ setDictationKeyLocal(envKey);
+ }
+ };
+ sync().catch(() => {});
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ const [audioCuesEnabled, setAudioCuesEnabled] = useLocalStorage("audioCuesEnabled", true, {
+ serialize: String,
+ deserialize: (value) => value !== "false",
+ });
+
+ // Floating icon auto-hide setting
+ const [floatingIconAutoHide, setFloatingIconAutoHideLocal] = useLocalStorage(
+ "floatingIconAutoHide",
+ false,
+ {
+ serialize: String,
+ deserialize: (value) => value === "true",
+ }
+ );
+
+ const setFloatingIconAutoHide = useCallback(
+ (enabled: boolean) => {
+ setFloatingIconAutoHideLocal(enabled);
+ if (typeof window !== "undefined" && window.electronAPI?.notifyFloatingIconAutoHideChanged) {
+ window.electronAPI.notifyFloatingIconAutoHideChanged(enabled);
+ }
+ },
+ [setFloatingIconAutoHideLocal]
+ );
+
// Microphone settings
const [preferBuiltInMic, setPreferBuiltInMic] = useLocalStorage("preferBuiltInMic", true, {
serialize: String,
@@ -679,6 +728,10 @@ export function useSettings() {
setTheme,
activationMode,
setActivationMode,
+ audioCuesEnabled,
+ setAudioCuesEnabled,
+ floatingIconAutoHide,
+ setFloatingIconAutoHide,
preferBuiltInMic,
selectedMicDeviceId,
setPreferBuiltInMic,
@@ -692,3 +745,20 @@ export function useSettings() {
updateApiKeys,
};
}
+
+export type SettingsValue = ReturnType<typeof useSettingsInternal>;
+
+const SettingsContext = createContext<SettingsValue | null>(null);
+
+export function SettingsProvider({ children }: { children: React.ReactNode }) {
+ const value = useSettingsInternal();
+ return React.createElement(SettingsContext.Provider, { value }, children);
+}
+
+export function useSettings(): SettingsValue {
+ const ctx = useContext(SettingsContext);
+ if (!ctx) {
+ throw new Error("useSettings must be used within a SettingsProvider");
+ }
+ return ctx;
+}
diff --git a/src/hooks/useTheme.ts b/src/hooks/useTheme.ts
index 80c9cb526..0dcbf62e8 100644
--- a/src/hooks/useTheme.ts
+++ b/src/hooks/useTheme.ts
@@ -15,8 +15,6 @@ export function useTheme() {
: "light"
: theme;
- console.log("[useTheme] Applying theme:", effectiveTheme, "from setting:", theme);
-
// Apply dark class
if (effectiveTheme === "dark") {
htmlElement.classList.add("dark");
diff --git a/src/index.css b/src/index.css
index dc25ce3a0..dcf93c383 100644
--- a/src/index.css
+++ b/src/index.css
@@ -367,7 +367,16 @@ a:hover {
filter: invert(1);
}
-/* Toast progress bar animation */
+/* Toast — opaque dark HUD surface, same in light & dark mode */
+.toast-surface {
+ background: oklch(0.13 0.005 270);
+ border: 1px solid oklch(0.22 0.005 270);
+ box-shadow:
+ inset 0 1px 0 oklch(1 0 0 / 0.04),
+ 0 8px 24px -4px oklch(0 0 0 / 0.5),
+ 0 2px 8px -2px oklch(0 0 0 / 0.3);
+}
+
@keyframes toast-progress {
from {
width: 100%;
@@ -412,27 +421,28 @@ a:hover {
}
}
-/* Custom scrollbar styling for Windows/Linux (Chromium) */
::-webkit-scrollbar {
- width: 8px;
- height: 8px;
+ width: 6px;
+ height: 6px;
}
::-webkit-scrollbar-track {
- background: var(--color-surface-1);
- border-radius: var(--radius-sm);
+ background: transparent;
}
::-webkit-scrollbar-thumb {
+ background: transparent;
+ border-radius: 3px;
+}
+
+:hover::-webkit-scrollbar-thumb {
background: var(--color-border);
- border-radius: var(--radius-sm);
- border: 2px solid var(--color-surface-1);
}
-::-webkit-scrollbar-thumb:hover {
+:hover::-webkit-scrollbar-thumb:hover {
background: var(--color-border-hover);
}
::-webkit-scrollbar-corner {
- background: var(--color-surface-1);
+ background: transparent;
}
diff --git a/src/main.jsx b/src/main.jsx
index 5e4aabc82..91feaa550 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -1,18 +1,20 @@
-import React, { useState, useEffect } from "react";
+import React, { Suspense, useState, useEffect } from "react";
import ReactDOM from "react-dom/client";
import App from "./App.jsx";
-import ControlPanel from "./components/ControlPanel.tsx";
-import OnboardingFlow from "./components/OnboardingFlow.tsx";
import AuthenticationStep from "./components/AuthenticationStep.tsx";
import TitleBar from "./components/TitleBar.tsx";
import SupportDropdown from "./components/ui/SupportDropdown.tsx";
import { Card, CardContent } from "./components/ui/card.tsx";
import ErrorBoundary from "./components/ErrorBoundary.tsx";
import { ToastProvider } from "./components/ui/Toast.tsx";
+import { SettingsProvider } from "./hooks/useSettings";
import { useTheme } from "./hooks/useTheme";
import { useAuth } from "./hooks/useAuth";
import "./index.css";
+const ControlPanel = React.lazy(() => import("./components/ControlPanel.tsx"));
+const OnboardingFlow = React.lazy(() => import("./components/OnboardingFlow.tsx"));
+
let root = null;
const VALID_CHANNELS = new Set(["development", "staging", "production"]);
@@ -312,19 +314,16 @@ function AppRouter() {
};
if (isLoading) {
- return (
- <div className="min-h-screen bg-background flex items-center justify-center">
- <div className="text-center">
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"></div>
- <p className="text-muted-foreground">Loading OpenWhispr...</p>
- </div>
- </div>
- );
+ return <LoadingFallback message="Loading OpenWhispr..." />;
}
// First-time user: full onboarding wizard
if (isControlPanel && showOnboarding) {
- return <OnboardingFlow onComplete={handleOnboardingComplete} />;
+ return (
+ <Suspense fallback={<LoadingFallback />}>
+ <OnboardingFlow onComplete={handleOnboardingComplete} />
+ </Suspense>
+ );
}
// Returning user needs to re-authenticate (signed out, setup already done)
@@ -362,7 +361,39 @@ function AppRouter() {
);
}
- return isControlPanel ? <ControlPanel /> : <App />;
+ return isControlPanel ? (
+ <Suspense fallback={<LoadingFallback />}>
+ <ControlPanel />
+ </Suspense>
+ ) : (
+ <App />
+ );
+}
+
+function LoadingFallback({ message }) {
+ return (
+ <div className="min-h-screen bg-background flex items-center justify-center">
+ <div className="flex flex-col items-center gap-4 animate-[scale-in_300ms_ease-out]">
+ <svg
+ viewBox="0 0 1024 1024"
+ className="w-12 h-12 drop-shadow-[0_2px_8px_rgba(37,99,235,0.18)] dark:drop-shadow-[0_2px_12px_rgba(100,149,237,0.25)]"
+ aria-label="OpenWhispr"
+ >
+ <rect width="1024" height="1024" rx="241" fill="#2056DF" />
+ <circle cx="512" cy="512" r="314" fill="#2056DF" stroke="white" strokeWidth="74" />
+ <path d="M512 383V641" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ <path d="M627 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ <path d="M397 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ </svg>
+ <div className="w-7 h-7 rounded-full border-[2.5px] border-transparent border-t-primary animate-[spinner-rotate_0.8s_cubic-bezier(0.4,0,0.2,1)_infinite] motion-reduce:animate-none motion-reduce:border-t-muted-foreground motion-reduce:opacity-50" />
+ {message && (
+ <p className="text-[13px] font-medium text-muted-foreground dark:text-foreground/60 tracking-[-0.01em]">
+ {message}
+ </p>
+ )}
+ </div>
+ </div>
+ );
}
function mountApp() {
@@ -372,9 +403,11 @@ function mountApp() {
root.render(
<React.StrictMode>
<ErrorBoundary>
- <ToastProvider>
- <AppRouter />
- </ToastProvider>
+ <SettingsProvider>
+ <ToastProvider>
+ <AppRouter />
+ </ToastProvider>
+ </SettingsProvider>
</ErrorBoundary>
</React.StrictMode>
);
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 4e2bf5941..5f71e40b5 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -412,6 +412,8 @@ declare global {
// Windows Push-to-Talk notifications
notifyActivationModeChanged?: (mode: "tap" | "push") => void;
notifyHotkeyChanged?: (hotkey: string) => void;
+ notifyFloatingIconAutoHideChanged?: (enabled: boolean) => void;
+ onFloatingIconAutoHideChanged?: (callback: (enabled: boolean) => void) => () => void;
// Auto-start at login
getAutoStartEnabled?: () => Promise<boolean>;
diff --git a/src/utils/dictationCues.js b/src/utils/dictationCues.js
index 5fb71c2d1..dfbb30255 100644
--- a/src/utils/dictationCues.js
+++ b/src/utils/dictationCues.js
@@ -1,10 +1,10 @@
import logger from "./logger";
-const START_NOTES = [880, 1174.66];
-const STOP_NOTES = [1174.66, 880];
-const NOTE_DURATION_SECONDS = 0.06;
-const NOTE_GAP_SECONDS = 0.02;
-const NOTE_ATTACK_SECONDS = 0.008;
+const START_NOTES = [523.25, 659.25];
+const STOP_NOTES = [587.33, 440];
+const NOTE_DURATION_SECONDS = 0.09;
+const NOTE_GAP_SECONDS = 0.025;
+const NOTE_ATTACK_SECONDS = 0.015;
const MAX_GAIN = 0.2;
const MIN_GAIN = 0.0001;
@@ -68,8 +68,12 @@ const scheduleTone = (context, frequency, startTime) => {
oscillator.stop(stopTime + 0.01);
};
+const isEnabled = () => localStorage.getItem("audioCuesEnabled") !== "false";
+
const playCue = async (notes) => {
try {
+ if (!isEnabled()) return;
+
const context = await resumeContextIfNeeded();
if (!context) {
return;
diff --git a/src/vite.config.mjs b/src/vite.config.mjs
index 997a75cb1..d10d87a2b 100644
--- a/src/vite.config.mjs
+++ b/src/vite.config.mjs
@@ -76,7 +76,18 @@ export default defineConfig(({ mode }) => {
'tar',
'unzipper',
'@aws-sdk/client-s3'
- ]
+ ],
+ output: {
+ manualChunks: {
+ 'vendor-radix': [
+ '@radix-ui/react-dialog',
+ '@radix-ui/react-dropdown-menu',
+ '@radix-ui/react-select',
+ '@radix-ui/react-tabs',
+ ],
+ 'vendor-icons': ['lucide-react'],
+ },
+ },
}
}
}