[eric] voice: fn-watcher compiles per-arch into build-staging and ships via extraResources

This commit is contained in:
ciregenz
2026-08-05 21:12:15 -07:00
parent 3045c42a93
commit 99d8ef8314
4 changed files with 30 additions and 1 deletions
+7
View File
@@ -76,6 +76,13 @@
"**/*"
]
},
{
"from": "build-staging/fn-watcher/${arch}",
"to": "fn-watcher",
"filter": [
"**/*"
]
},
{
"from": "build-staging/haptics/${arch}",
"to": "haptics",
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Compile the macOS fn/Globe key watcher for one arch and stage it where electron-builder's
# extraResources picks it up (build-staging/fn-watcher/<arch>). See electron/native/fn-watcher.swift
# for why this exists (libuiohook cannot see keycode 63, so dictation's fn trigger needs a native tap).
set -euo pipefail
ARCH="${1:?usage: build-fn-watcher.sh <arm64|x64>}"
HERE="$(cd "$(dirname "$0")/.." && pwd)" # electron/
SRC="$HERE/native/fn-watcher.swift"
OUT="$HERE/build-staging/fn-watcher/$ARCH"
TARGET="arm64-apple-macos11"
[[ "$ARCH" == "x64" ]] && TARGET="x86_64-apple-macos11"
echo "[fn-watcher] building for arch=$ARCH (target $TARGET)"
mkdir -p "$OUT"
swiftc -O -target "$TARGET" -o "$OUT/fn-watcher" "$SRC"
echo "[fn-watcher] staged -> $OUT/fn-watcher"
file "$OUT/fn-watcher"
+1 -1
View File
@@ -58,7 +58,7 @@ function parseCombo(str) {
// stay primary on null). The dev compile is async: a first-boot swiftc must never freeze startup.
function resolveFnWatcherBinary(cb) {
if (process.platform !== 'darwin') { cb(null); return; }
const bundled = path.join(process.resourcesPath || '', 'fn-watcher');
const bundled = path.join(process.resourcesPath || '', 'fn-watcher', 'fn-watcher');
if (fs.existsSync(bundled)) { cb(bundled); return; }
const src = path.join(__dirname, 'native', 'fn-watcher.swift');
if (!fs.existsSync(src)) { cb(null); return; }