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.

Offer to take notes for Meet calls in Dia and Arc, whose mic helper is named for neither (#131)

christianmatb47c0d61518c
diff --git a/app/native/yogurt-mac/main.swift b/app/native/yogurt-mac/main.swift
index c5a3d0a6..3eb37025 100644
--- a/app/native/yogurt-mac/main.swift
+++ b/app/native/yogurt-mac/main.swift
@@ -4,7 +4,8 @@
// yogurt-mac calendar-status → {"status":"granted"|"denied"|"notDetermined"}
// yogurt-mac calendar-auth → asks once (the system's own prompt), then the status
// yogurt-mac events FROM TO → meetings between two ISO dates (all-day and cancelled ones left out)
-// yogurt-mac mic-apps → [{"bundleId","name","pid"}] of processes using audio input right now
+// yogurt-mac mic-apps → [{"bundleId","name","pid","app"?}] of processes using audio input right now;
+// app: the app the process sits inside, when that is another one
// yogurt-mac mic-watch → the same as mic-apps, one JSON line at start and on each change, until stdin closes
// (stdin lines "recording" / "idle" set how often it reads again: 1.5 s / 3 s):
// one Core Audio client for Yogurt's whole life instead of one per reading (#143)
@@ -115,6 +116,15 @@ func inputDevices() -> [[String: Any]] {
return ["uid": uid, "name": name, "default": d == def]
}
}
+/// The bundle ID of the outermost app a process sits inside: Dia's mic helper lives in Dia.app/Contents/Frameworks/…
+/// under an ID Arc ships too (#131)
+func enclosingAppId(_ pid: pid_t) -> String? {
+ var buf = [CChar](repeating: 0, count: 4096)
+ guard proc_pidpath(pid, &buf, UInt32(buf.count)) > 0 else { return nil }
+ let path = String(cString: buf)
+ guard let r = path.range(of: ".app/") else { return nil }
+ return Bundle(path: String(path[..<r.lowerBound]) + ".app")?.bundleIdentifier
+}
func audioApps(input: Bool) -> [[String: Any]] {
let me = ProcessInfo.processInfo.processIdentifier
return audioProcesses().compactMap { obj in
@@ -126,7 +136,9 @@ func audioApps(input: Bool) -> [[String: Any]] {
var buf = [CChar](repeating: 0, count: 256)
_ = proc_name(pid, &buf, 256)
let name = NSRunningApplication(processIdentifier: pid)?.localizedName ?? (id.isEmpty ? String(cString: buf) : id)
- return ["bundleId": id, "name": name, "pid": Int(pid)]
+ var row: [String: Any] = ["bundleId": id, "name": name, "pid": Int(pid)]
+ if let app = enclosingAppId(pid), app != id { row["app"] = app }
+ return row
}
}
diff --git a/app/src/main/detectSignals.ts b/app/src/main/detectSignals.ts
index 10e88c37..6dfc3205 100644
--- a/app/src/main/detectSignals.ts
+++ b/app/src/main/detectSignals.ts
@@ -2,6 +2,12 @@ import type { CalEvent, Helper } from './calendar'
import { callAppId, tabTitleApp, type MicApp } from './detect'
const MIN = 60_000
+/**
+ * A helper whose own bundle ID matches no call app counts as the app it sits inside (`app`, from its path): Dia's and
+ * Arc's mic helper share one ID, company.thebrowser.browser.helper (#131).
+ */
+const ownerOf = (bundleId: string, app: unknown): string =>
+ !callAppId(bundleId) && typeof app === 'string' && callAppId(app) ? app : bundleId
const TITLE_TTL = 10_000
/** What the Mac says right now: which apps use the mic, and the calendar around now. */
@@ -27,7 +33,7 @@ export function createSignals(d: { helper: Helper; micApps?: () => Promise<unkno
try {
const raw = d.micApps ? await d.micApps() : 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,
+ bundleId: ownerOf(r.bundleId, r.app), 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 } : {}),
}] : [])
diff --git a/app/test/detectSignals.test.ts b/app/test/detectSignals.test.ts
index bade0b5c..98c49d3b 100644
--- a/app/test/detectSignals.test.ts
+++ b/app/test/detectSignals.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest'
import { createSignals } from '../src/main/detectSignals'
+import { decide } from '../src/main/detect'
const chrome = { bundleId: 'com.google.Chrome', name: 'Google Chrome', pid: 1 }
const zoom = { bundleId: 'us.zoom.xos', name: 'zoom.us', pid: 2 }
@@ -99,3 +100,33 @@ it('keeps the pid of the process on the mic, so names are read from that process
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 }])
})
+
+// Dia's mic is held by a helper whose bundle ID matches no app; Arc ships the same one (#131). Core Audio showed it as
+// /Applications/Dia.app/Contents/Frameworks/ArcCore.framework/Helpers/Browser Helper (Aperitif).app, parent
+// /Applications/Dia.app/Contents/MacOS/Dia. yogurt-mac reports the app the process sits inside as `app`.
+describe('a helper inside another app (#131)', () => {
+ const aperitif = (app: string) => ({ bundleId: 'company.thebrowser.browser.helper', name: 'Browser Helper (Aperitif)', pid: 71, app })
+ it('a Meet call in Dia counts as Dia', async () => {
+ const x = setup({ mic: [aperitif('company.thebrowser.dia')] })
+ const r = await x.s.read(0)
+ expect(r.micApps[0]).toMatchObject({ bundleId: 'company.thebrowser.dia', pid: 71, title: 'Meet - abc-defg-hij' })
+ expect(x.titleCalls()).toEqual([['browser-title', 'company.thebrowser.dia']])
+ expect(decide({ micApps: r.micApps, events: [], recording: false, runningApps: r.runningApps }, 0, new Set())).toMatchObject({ app: 'Dia' })
+ })
+ it('the same helper in Arc counts as Arc', async () => {
+ const x = setup({ mic: [aperitif('company.thebrowser.Browser')] })
+ const r = await x.s.read(0)
+ expect(decide({ micApps: r.micApps, events: [], recording: false, runningApps: r.runningApps }, 0, new Set())).toMatchObject({ app: 'Arc' })
+ })
+ it('a helper inside an app that makes no calls stays ignored', async () => {
+ const x = setup({ mic: [{ bundleId: 'com.example.recorder.helper', name: 'Recorder Helper', pid: 72, app: 'com.example.recorder' }] })
+ const r = await x.s.read(0)
+ expect(r.micApps[0].bundleId).toBe('com.example.recorder.helper')
+ expect(x.titleCalls()).toEqual([])
+ expect(decide({ micApps: r.micApps, events: [], recording: false, runningApps: r.runningApps }, 0, new Set())).toBeNull()
+ })
+ it('a helper that already matches keeps its own bundle ID', async () => {
+ const x = setup({ mic: [{ bundleId: 'com.google.Chrome.helper', name: 'Google Chrome Helper', pid: 73, app: 'com.google.Chrome' }] })
+ expect((await x.s.read(0)).micApps[0].bundleId).toBe('com.google.Chrome.helper')
+ })
+})