Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Call names: with two Zoom meetings open, read only the one on the mic, so names never cross between meetings (#98)

christianmatd15338006c36
diff --git a/app/native/yogurt-mac/main.swift b/app/native/yogurt-mac/main.swift
index c3e0a0ad..42f3e8ed 100644
--- a/app/native/yogurt-mac/main.swift
+++ b/app/native/yogurt-mac/main.swift
@@ -16,8 +16,10 @@
// yogurt-mac media-resume ID... → {"resumed":[bundle ids]}: plays those again, unless they are already playing
// yogurt-mac mic-devices → {"devices":[{"uid","name","default":bool}]}: every microphone, and which one the Mac uses now
// yogurt-mac ax-auth → asks for Accessibility once (the system's own prompt), then {"trusted":bool}
-// yogurt-mac call-watch MS ID... → one JSON line every MS ms until stdin closes: the call app's meeting windows as
-// accessibility trees {"t","app","windows":[{"title","id","tree"}]}, or {"t","error"}
+// yogurt-mac call-watch MS [--pid N]... ID...
+// → one JSON line every MS ms until stdin closes: the call app's meeting windows as
+// accessibility trees {"t","app","windows":[{"title","id","tree"}]}, or {"t","error"};
+// with --pid, only the app processes those mic processes belong to
import AVFoundation
import AppKit
import CoreAudio
@@ -368,7 +370,20 @@ func callWindows(_ app: AXUIElement, _ id: String) -> (wins: [AXUIElement], tab:
return ([w as! AXUIElement], title)
}
-func watchCalls(every: Int, ids: [String]) {
+/// The app a process on the mic belongs to: itself, or the app above it (Zoom's CptHost runs under zoom.us)
+func owningApp(_ pid: pid_t, ids: [String]) -> NSRunningApplication? {
+ var pid = pid
+ for _ in 0..<8 {
+ if let r = NSRunningApplication(processIdentifier: pid), let id = r.bundleIdentifier, ids.contains(id) { return r }
+ var info = proc_bsdinfo()
+ let size = Int32(MemoryLayout<proc_bsdinfo>.size)
+ guard proc_pidinfo(pid, PROC_PIDTBSDINFO, 0, &info, size) == size, info.pbi_ppid > 1 else { return nil }
+ pid = pid_t(info.pbi_ppid)
+ }
+ return nil
+}
+
+func watchCalls(every: Int, ids: [String], pids: [pid_t] = []) {
// Yogurt closes stdin to stop the watch (and a crashed Yogurt closes it too)
DispatchQueue.global().async { _ = FileHandle.standardInput.readDataToEndOfFile(); DispatchQueue.main.sync { resetTrees() }; exit(0) }
let line = { (v: [String: Any]) in
@@ -384,7 +399,9 @@ func watchCalls(every: Int, ids: [String]) {
// the frontmost of the apps asked about that shows a call, else the first one that does
lastControlLook = ""
let front = NSWorkspace.shared.frontmostApplication?.processIdentifier
- let running = ids.compactMap { NSRunningApplication.runningApplications(withBundleIdentifier: $0).first }
+ // With the processes on the mic given, only their apps: two Zoom meetings are two processes, and the one not
+ // being recorded must never give this meeting its names (#98)
+ let running = (pids.isEmpty ? ids.compactMap { NSRunningApplication.runningApplications(withBundleIdentifier: $0).first } : pids.compactMap { owningApp($0, ids: ids) })
.sorted { a, _ in a.processIdentifier == front }
var found: (NSRunningApplication, AXUIElement, [AXUIElement], String?)?
for r in running {
@@ -510,10 +527,12 @@ case "media-resume":
case "ax-auth":
out(["trusted": AXIsProcessTrustedWithOptions([kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary)])
case "call-watch":
- guard args.count >= 3, let every = Int(args[1]) else { fail("call-watch MS BUNDLE_ID...") }
- watchCalls(every: max(100, every), ids: Array(args.dropFirst(2)))
+ guard args.count >= 3, let every = Int(args[1]) else { fail("call-watch MS [--pid N]... BUNDLE_ID...") }
+ var rest = Array(args.dropFirst(2)), pids: [pid_t] = []
+ while rest.count >= 2, rest[0] == "--pid", let pid = pid_t(rest[1]) { pids.append(pid); rest.removeFirst(2) }
+ watchCalls(every: max(100, every), ids: rest, pids: pids)
case "mic-devices":
out(["devices": inputDevices()])
default:
- fail("usage: yogurt-mac calendar-status | calendar-auth | events FROM TO | mic-apps | running-apps ID... | browser-title ID | permissions | media-auth | mic-auth | audio-auth | media-pause | media-resume ID... | mic-devices | ax-auth | call-watch MS ID...")
+ fail("usage: yogurt-mac calendar-status | calendar-auth | events FROM TO | mic-apps | running-apps ID... | browser-title ID | permissions | media-auth | mic-auth | audio-auth | media-pause | media-resume ID... | mic-devices | ax-auth | call-watch MS [--pid N]... ID...")
}
diff --git a/app/src/main/callNames/index.ts b/app/src/main/callNames/index.ts
index ed6ed8d4..6156626e 100644
--- a/app/src/main/callNames/index.ts
+++ b/app/src/main/callNames/index.ts
@@ -13,7 +13,8 @@ import { readCall, summarize, type AxWindow, type CallKind } from './parse'
/** what yogurt-mac call-watch prints each time it reads: the call windows, or why it could not */
export type WatchLine = { t: number; app?: string; windows?: AxWindow[]; error?: string }
-export type Watch = (ids: string[], onLine: (l: WatchLine) => void) => { stop(): void }
+/** pids: read only these processes' windows (the call app's processes on the mic); none known, the app's frontmost with a call */
+export type Watch = (ids: string[], onLine: (l: WatchLine) => void, pids?: number[]) => { stop(): void }
/** the call apps that can be read, by the name meeting detection gives them (detect.ts), and the kind of window each
* has. A Mac's ids are bundle ids; Linux's are program names or Flatpak app ids; Windows's are program file names,
@@ -55,7 +56,7 @@ const MAX_RESTARTS = 20
const LOGGED_CHANGES = 30
type Sample = Omit<CallSample, 'ms'> & { t: number }
-type Session = { app: string | null; ids: string[]; heardAt: number; restarts: number; samples: Sample[]; priorLines: Set<number>; watch?: { stop(): void }; everyApp: boolean; offset?: number; startedAt: number; pictured: boolean; errors: Set<string>; last: string; logged: number }
+type Session = { app: string | null; ids: string[]; pids?: number[]; heardAt: number; restarts: number; samples: Sample[]; priorLines: Set<number>; watch?: { stop(): void }; everyApp: boolean; offset?: number; startedAt: number; pictured: boolean; errors: Set<string>; last: string; logged: number }
export function hookCallNames(p: {
store: Pick<Store, 'meeting' | 'segments' | 'setSegmentSpeakers' | 'updateMeeting'>
@@ -69,6 +70,8 @@ export function hookCallNames(p: {
onStart: (fn: (m: RecordingStart) => void) => unknown
onStop: (fn: (m: Meeting) => void) => unknown
onCapture: (fn: (c: { on(e: 'pcm', fn: (track: 'me' | 'them', ms: number, samples: Float32Array) => void): unknown }, meetingId: string) => void) => unknown
+ /** the processes of a call app on the mic now (detect.ts micPids): two Zoom meetings are two processes (#98) */
+ micPids?: (app: string) => number[]
/** a recording started by hand learned its call app from the mic (watch.ts, CALL bind) */
onBind?: (fn: (m: Meeting) => void) => unknown
log?: (msg: string) => void
@@ -112,12 +115,20 @@ export function hookCallNames(p: {
s.last = said
}
+ /** Starts the session's reader. With its app's process on the mic known, only that one is read: another meeting open
+ * in the same app (a second Zoom process) never gives this one its names or people (#98). */
+ const begin = (id: string, s: Session) => {
+ const pids = s.pids ?? (s.app ? p.micPids?.(s.app) : undefined)
+ s.pids = pids?.length ? pids : undefined
+ try { s.watch = p.watch(s.ids, (l) => onLine(id, s, l), s.pids) } catch (e) { console.error('call names: the watch did not start', e) }
+ }
+
p.onStart((m) => {
const ids = watchIds(m.app)
const s: Session = { app: m.app, ids, heardAt: now(), restarts: 0, everyApp: !m.app, samples: [], priorLines: new Set(p.store.segments(m.id, { hidden: true }).map((line) => line.id)), startedAt: m.resume ? m.resume.startedAt - m.resume.startMs : m.startedAt, pictured: false, errors: new Set(), last: '', logged: 0 }
sessions.set(m.id, s)
if (!ids.length) { log(`call names: ${m.app} can't be read, the other side is Them`); return }
- try { s.watch = p.watch(ids, (l) => onLine(m.id, s, l)) } catch (e) { console.error('call names: the watch did not start', e) }
+ begin(m.id, s)
})
// A recording started by hand reads every call app, the frontmost with a call first; another app's window (a Teams
@@ -133,7 +144,7 @@ export function hookCallNames(p: {
log(`call names: the call is in ${m.app}, reading only it`)
if (!ids.length) return
s.pictured = false
- try { s.watch = p.watch(ids, (l) => onLine(m.id, s, l)) } catch (e) { console.error('call names: the watch did not start', e) }
+ begin(m.id, s)
})
// meeting time 0 on the wall clock: the earliest any audio could have been heard (each frame arrives a little after it was said)
@@ -173,12 +184,21 @@ export function hookCallNames(p: {
/** a reader that stopped sending readings is stopped and started again (the cause is logged where it's known) */
function checkQuiet() {
for (const [id, s] of sessions) {
+ // the app came on the mic after the reader started: from now on only that process, and what was read before
+ // may be another meeting's (#98)
+ if (s.watch && s.app && !s.pids && p.micPids?.(s.app).length) {
+ log(`call names: ${s.app} is on the mic now, reading only its process`)
+ s.watch.stop(); s.watch = undefined
+ s.samples = []; s.heardAt = now(); s.pictured = false
+ begin(id, s)
+ continue
+ }
if (!s.watch || !s.ids.length || now() - s.heardAt <= QUIET_MS || s.restarts >= MAX_RESTARTS) continue
log(`call names: the reader went quiet for ${Math.round((now() - s.heardAt) / 1000)} s; starting it again`)
s.restarts++
s.watch.stop(); s.watch = undefined
s.heardAt = now()
- try { s.watch = p.watch(s.ids, (l) => onLine(id, s, l)) } catch (e) { console.error('call names: the watch did not start', e) }
+ begin(id, s)
}
}
;(p.every ?? ((fn, ms) => setInterval(fn, ms).unref()))(checkQuiet, 2000)
diff --git a/app/src/main/callNames/watch.ts b/app/src/main/callNames/watch.ts
index 19f40210..e2d603c9 100644
--- a/app/src/main/callNames/watch.ts
+++ b/app/src/main/callNames/watch.ts
@@ -7,9 +7,13 @@ import { WATCH_EVERY_MS, type Watch, type WatchLine } from './index'
const running = new Set<ChildProcess>()
export const killAllWatches = () => { for (const c of running) c.kill('SIGKILL'); running.clear() }
+/** The helper's arguments: with the processes on the mic known, only their windows are read (#98) */
+export const watchArgs = (ids: string[], pids: number[] = []): string[] =>
+ ['call-watch', String(WATCH_EVERY_MS), ...pids.flatMap((pid) => ['--pid', String(pid)]), ...ids]
+
/** yogurt-mac call-watch (or yogurt-system on Linux): one JSON line per reading of the call app, until its stdin is closed */
-export const helperWatch = (binary: () => string): Watch => (ids, onLine) => {
- const child = spawn(binary(), ['call-watch', String(WATCH_EVERY_MS), ...ids], { stdio: ['pipe', 'pipe', 'pipe'] })
+export const helperWatch = (binary: () => string): Watch => (ids, onLine, pids) => {
+ const child = spawn(binary(), watchArgs(ids, pids), { stdio: ['pipe', 'pipe', 'pipe'] })
running.add(child)
// recording and transcription come first
if (child.pid) { try { os.setPriority(child.pid, 10) } catch { /* it may have exited already */ } }
diff --git a/app/src/main/detect.ts b/app/src/main/detect.ts
index d68fcac7..7745a515 100644
--- a/app/src/main/detect.ts
+++ b/app/src/main/detect.ts
@@ -1,6 +1,6 @@
import type { CalEvent } from './calendar'
-export type MicApp = { bundleId: string; name: string; /** the window's title, when known */ title?: string }
+export type MicApp = { bundleId: string; name: string; /** the process on the mic */ pid?: number; /** the window's title, when known */ title?: string }
export type Signals = { micApps: MicApp[]; events: CalEvent[]; recording: boolean; /** owners confirmed by NSRunningApplication */ runningApps?: string[] }
export type Prompt = { key: string; /** the event's title; empty with no event (the window words it) */ title: string; app: string | null; event: CalEvent | null }
/** keys of prompts the person closed */
@@ -94,6 +94,10 @@ const micApp = (bundleId: string, runningApps: readonly string[] = []) => {
/** Helpers count only while their owning app is running. Direct app mic holders prove their own presence. */
export const callAppName = (bundleId: string, runningApps?: readonly string[]): string | null => micApp(bundleId, runningApps)?.name ?? null
+/** The processes of a call app on the mic now, its helpers too: with two Zoom meetings open, the one being recorded (#98) */
+export const micPids = (micApps: readonly MicApp[], runningApps: readonly string[] | undefined, app: string): number[] =>
+ micApps.flatMap((m) => (m.pid !== undefined && callAppName(m.bundleId, runningApps) === app ? [m.pid] : []))
+
/** The browser to ask for the front tab's name when this process is on the mic; null for apps that are not browsers */
export const tabTitleApp = (bundleId: string): string | null => {
const a = appOf(bundleId)
diff --git a/app/src/main/detectSignals.ts b/app/src/main/detectSignals.ts
index 268d3556..d94dd11e 100644
--- a/app/src/main/detectSignals.ts
+++ b/app/src/main/detectSignals.ts
@@ -25,7 +25,11 @@ export function createSignals(d: { helper: Helper; events: (from: number, to: nu
let micApps: MicApp[] = []
try {
const raw = await d.helper(['mic-apps'])
- if (Array.isArray(raw)) micApps = raw.flatMap((r: Record<string, unknown>) => typeof r?.bundleId === 'string' ? [{ bundleId: r.bundleId, name: typeof r.name === 'string' ? r.name : r.bundleId }] : [])
+ if (Array.isArray(raw)) micApps = raw.flatMap((r: Record<string, unknown>) => typeof r?.bundleId === 'string' ? [{
+ bundleId: r.bundleId, name: typeof r.name === 'string' ? r.name : r.bundleId,
+ // which process: two Zoom meetings are two processes, and names come only from the one on the mic (#98)
+ ...(typeof r.pid === 'number' ? { pid: r.pid } : {}),
+ }] : [])
} catch { /* no helper: no signal */ }
const owners = [...new Set(micApps.flatMap(m => {
const id = callAppId(m.bundleId)
diff --git a/app/src/main/index.ts b/app/src/main/index.ts
index b990683d..793b0d8c 100644
--- a/app/src/main/index.ts
+++ b/app/src/main/index.ts
@@ -27,7 +27,7 @@ import { pathToFileURL } from 'node:url'
import { isFake, userDataDir } from './paths'
import { logToFile } from './log'
import { includesRecordingCredit, loadSettings, localeOf, keepsRecording, recordingReminderOn, spokenSetting, stopsWhenCallEnds, updateSettings, visibilityOf, summaryLanguageSetting } from './settings'
-import { CALL_GONE_MS, useCallApps, watchEveryMs } from './detect'
+import { CALL_GONE_MS, micPids, useCallApps, watchEveryMs, type MicApp } from './detect'
import { systemLocale } from './locale'
import { language as uiLanguage, onLanguage, setLanguage, t } from '../shared/i18n'
import bundledCatalog from '../../../catalog/catalog.json'
@@ -307,6 +307,9 @@ const macName = () => (isFake() ? process.env.YOGURT_FAKE_FULL_NAME ?? 'Sam Rive
/** starting and pausing a recording the way home and the widget do, for AI apps (set once detection starts) */
let recordingControls: { start(o: { eventId?: string; title?: string }): Promise<StartResult>; pause(id: unknown, paused: unknown): boolean } | undefined
+/** the processes of a call app on the mic at the last reading (set once detection starts): names come only from them (#98) */
+let micPidsNow: (app: string) => number[] = () => []
+
/** fake mode's hooks reach the store and the notes through these */
let storeRef: Store | undefined
let indexerRef: { schedule(): Promise<unknown> } | undefined
@@ -316,10 +319,13 @@ function startDetection() {
if (isFake()) setHelper(fakeHelper)
const signals = createSignals({ helper: runHelper, events: readCalendar })
refreshCalendarConsumers = () => signals.invalidateCalendar()
+ let lastReading: { micApps: MicApp[]; runningApps?: string[] } | undefined
+ // yogurt-system (Windows, Linux) reads no single process yet; the Mac helper does
+ if (process.platform === 'darwin') micPidsNow = (app) => (lastReading ? micPids(lastReading.micApps, lastReading.runningApps, app) : [])
const now = isFake() ? fakeNow : Date.now
let fakeSilence: number | undefined
const watcher: Watcher = new Watcher({
- read: (at) => signals.read(at), now, active: activeMeeting, bindApp: bindMeetingApp,
+ read: async (at) => (lastReading = await signals.read(at)), now, active: activeMeeting, bindApp: bindMeetingApp,
offer: (p) => prompts.offer(p), askStop: (m) => prompts.askStop(m), hide: () => prompts.hide(),
// the call ended: the same stop as the widget's Stop button, then say so
autoStop: (m) => { widget.callEnded(m.id); stopMeeting(m.id); prompts.stopped(m) },
@@ -593,7 +599,7 @@ app.whenReady().then(() => {
transcribed: async (id) => { await recordingFinished(id); await transcriptFinished(id) },
// people seen in the call joined the meeting: unedited notes already written get written again for them
changed: (id) => { win?.webContents.send('transcript:speakers', id); sendWidgetTranscript('transcript:speakers', id); win?.webContents.send('meetings:changed'); notes.applyPeople(id) },
- onStart: onMeetingStart, onStop: onMeetingStop, onCapture: onCaptureStart, onBind: onMeetingBound,
+ onStart: onMeetingStart, onStop: onMeetingStop, onCapture: onCaptureStart, onBind: onMeetingBound, micPids: (app) => micPidsNow(app),
})
// Windows and Linux: whisper left the graphics card in a meeting, so the speed check (timed with it) runs again next start
onWhisperGpuOff(() => speedStore(speedFile()).forget())
diff --git a/app/test/callNames.test.ts b/app/test/callNames.test.ts
index 15fea40a..9766c6c1 100644
--- a/app/test/callNames.test.ts
+++ b/app/test/callNames.test.ts
@@ -40,12 +40,13 @@ const webexCurrentWindows = (): WatchLine['windows'] => [{ title: 'Webex meeting
] }] } }]
const webexLine = (t: number): WatchLine => ({ t, app: 'Cisco-Systems.Spark', windows: webexWindows() })
-function setup(o: { app?: string | null; attendees?: Meeting['attendees'] } = {}) {
+function setup(o: { app?: string | null; attendees?: Meeting['attendees']; micPids?: Record<string, number[]> } = {}) {
const root = mkdtempSync(join(tmpdir(), 'yogurt-callnames-')); dirs.push(root)
const store = openStore(join(root, 'yogurt.db')); stores.push(store)
const m = store.createMeeting({ title: 'Sync', startedAt: 1_000_000, endedAt: null, eventId: null, app: o.app === undefined ? 'Zoom' : o.app, attendees: o.attendees ?? [], state: 'recording' })
let clock = 1_000_000
- const watched: string[][] = []
+ const watched: string[][] = [], watchedPids: Array<number[] | undefined> = []
+ const micPids = { ...o.micPids }
let emit!: (l: WatchLine) => void
let stopped = 0
const starts: Array<(m: Meeting) => void> = [], stops: Array<(m: Meeting) => void> = [], binds: Array<(m: Meeting) => void> = []
@@ -55,12 +56,15 @@ function setup(o: { app?: string | null; attendees?: Meeting['attendees'] } = {}
const done = new Promise<void>((r) => { transcribed = r })
const hook = hookCallNames({
store, myNames: () => ['Alex Morgan'], transcribed: () => done, changed: (id) => changed.push(id), log: (s) => logs.push(s), now: () => clock, every: () => {},
- watch: (ids, onLine) => { watched.push(ids); emit = onLine; return { stop: () => { stopped++ } } },
+ watch: (ids, onLine, pids) => { watched.push(ids); watchedPids.push(pids); emit = onLine; return { stop: () => { stopped++ } } },
+ micPids: (app) => micPids[app] ?? [],
onStart: (fn) => starts.push(fn), onStop: (fn) => stops.push(fn), onCapture: (fn) => captures.push(fn), onBind: (fn) => binds.push(fn),
})
const capture = new EventEmitter()
return {
- store, m, hook, watched, changed, logs, transcribed, stopped: () => stopped,
+ store, m, hook, watched, watchedPids, changed, logs, transcribed, stopped: () => stopped,
+ /** the processes of an app on the mic now */
+ setMic(app: string, pids: number[]) { micPids[app] = pids },
start() { starts.forEach((f) => f(m)); captures.forEach((f) => f(capture, m.id)) },
/** audio heard: meeting time `ms`, arriving at wall clock `at` */
audio(ms: number, at: number) { clock = at; capture.emit('pcm', 'them', ms, new Float32Array(1600)) },
@@ -195,6 +199,38 @@ describe('hookCallNames', () => {
expect(s.hook.nameFor('other', 1500, 4000)).toBeNull()
})
+ // #98: two Zoom meetings, two Zoom processes. The helper reads the processes it is given, else the frontmost one,
+ // which here is the other meeting.
+ const twoMeetings: Record<number, string[]> = { 501: ['Alex Morgan', 'Dana Smith'], 502: ['Alex Morgan', 'Priya Nair', 'Omar Haddad'] }
+ const helperReads = (pids: number[] | undefined) => twoMeetings[pids?.[0] ?? 502]
+ it('with two Zoom meetings open, only the one on the mic is read: no name from the other reaches this transcript or its attendees (#98)', async () => {
+ const s = setup({ micPids: { Zoom: [501] } })
+ s.start()
+ expect(s.watchedPids).toEqual([[501]])
+ s.audio(0, 1_000_100)
+ s.store.addSegments([{ meetingId: s.m.id, track: 'them', startMs: 1000, endMs: 3000, text: 'hi', speaker: null }])
+ const people = helperReads(s.watchedPids.at(-1))
+ for (let t = 1_000_000; t < 1_005_000; t += 500) s.emit(zoomLine(t, people, people[1], 'Alex Morgan'))
+ s.stop(); s.transcribed()
+ await s.hook.finished(s.m.id)
+ expect(s.store.segments(s.m.id).map((x) => x.speaker)).toEqual(['Dana Smith'])
+ expect(s.store.meeting(s.m.id)!.attendees.map((a) => a.name)).toEqual(['Dana Smith'])
+ })
+ it('a recording whose app was not on the mic yet is read again from only the process on the mic once it is, and what was read before is dropped (#98)', () => {
+ const s = setup()
+ s.start()
+ expect(s.watchedPids).toEqual([undefined])
+ s.audio(0, 1_000_100)
+ for (let t = 1_000_000; t < 1_002_000; t += 500) s.emit(zoomLine(t, helperReads(undefined), 'Priya Nair'))
+ s.setMic('Zoom', [501]); s.hook.checkQuiet()
+ expect(s.stopped()).toBe(1)
+ expect(s.watchedPids.at(-1)).toEqual([501])
+ expect(s.hook.nameFor(s.m.id, 0, 1000)).toBeNull()
+ // learned once: the watch isn't started again on every check
+ s.hook.checkQuiet()
+ expect(s.watchedPids).toHaveLength(2)
+ })
+
it('reads Webex roster names during a call', () => {
const s = setup({ app: 'Webex' })
s.start()
diff --git a/app/test/callWatchArgs.test.ts b/app/test/callWatchArgs.test.ts
new file mode 100644
index 00000000..ee48b6e0
--- /dev/null
+++ b/app/test/callWatchArgs.test.ts
@@ -0,0 +1,10 @@
+import { describe, expect, it } from 'vitest'
+import { watchArgs } from '../src/main/callNames/watch'
+
+describe('watchArgs: what the call watch is asked to read', () => {
+ it('names the processes on the mic when they are known, so only that meeting is read (#98)', () => {
+ expect(watchArgs(['us.zoom.xos'], [501, 777])).toEqual(['call-watch', '400', '--pid', '501', '--pid', '777', 'us.zoom.xos'])
+ expect(watchArgs(['us.zoom.xos'])).toEqual(['call-watch', '400', 'us.zoom.xos'])
+ expect(watchArgs(['us.zoom.xos'], [])).toEqual(['call-watch', '400', 'us.zoom.xos'])
+ })
+})
diff --git a/app/test/detect.test.ts b/app/test/detect.test.ts
index da91b859..7aa69bd2 100644
--- a/app/test/detect.test.ts
+++ b/app/test/detect.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { callAppId, tabTitleApp, CALL_GONE_MS, callGone, watchEveryMs, decide, ended, isOwnMicApp, useCallApps, type Signals } from '../src/main/detect'
+import { callAppId, micPids, tabTitleApp, CALL_GONE_MS, callGone, watchEveryMs, decide, ended, isOwnMicApp, useCallApps, type Signals } from '../src/main/detect'
import type { CalEvent } from '../src/main/calendar'
const NOW = Date.parse('2026-10-29T15:00:00Z')
@@ -209,3 +209,16 @@ describe('call apps on Windows and Linux', () => {
expect(isOwnMicApp('yogurt-audio')).toBe(false)
})
})
+
+describe('micPids: the processes of a call app on the mic (#98)', () => {
+ it('the app\'s own processes and its helpers, never another app\'s', () => {
+ const mic = [
+ { bundleId: 'us.zoom.xos', name: 'zoom.us', pid: 501 },
+ { bundleId: 'us.zoom.CptHost', name: 'CptHost', pid: 777 },
+ { bundleId: 'com.google.Chrome', name: 'Chrome', pid: 900 },
+ { bundleId: 'us.zoom.xos', name: 'zoom.us' },
+ ]
+ expect(micPids(mic, ['us.zoom.xos'], 'Zoom')).toEqual([501, 777])
+ expect(micPids(mic, [], 'Teams')).toEqual([])
+ })
+})
diff --git a/app/test/detectSignals.test.ts b/app/test/detectSignals.test.ts
index 807489f3..bade0b5c 100644
--- a/app/test/detectSignals.test.ts
+++ b/app/test/detectSignals.test.ts
@@ -95,3 +95,7 @@ it('does not turn a failed owner lookup into a false call end', async () => {
const x = createSignals({ helper: async args => args[0] === 'mic-apps' ? [{ bundleId: 'com.apple.avconferenced' }] : null, events: async () => [] })
await expect(x.read(0)).rejects.toThrow('Could not read running call apps')
})
+it('keeps the pid of the process on the mic, so names are read from that process only (#98)', async () => {
+ const x = createSignals({ helper: async (args) => args[0] === 'mic-apps' ? [{ bundleId: 'us.zoom.xos', name: 'zoom.us', pid: 501 }] : [], events: async () => [] })
+ expect((await x.read(0)).micApps).toEqual([{ bundleId: 'us.zoom.xos', name: 'zoom.us', pid: 501 }])
+})