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 (browsers on Mac): read Ardia's tab title, take its focused window when only the tab names Meet, and ask each call window itself for its page, which a live Meet call in Ardia needed (#123)

christianmat1ccb941edd57
diff --git a/app/native/yogurt-mac/main.swift b/app/native/yogurt-mac/main.swift
index 0a5f6820..30891e71 100644
--- a/app/native/yogurt-mac/main.swift
+++ b/app/native/yogurt-mac/main.swift
@@ -200,7 +200,7 @@ func browserTitle(_ id: String) -> String? {
return axText(axAttr(window as! AXUIElement, kAXTitleAttribute))
}
let safari = id == "com.apple.Safari"
- guard ["com.google.Chrome", "company.thebrowser.Browser", "com.microsoft.edgemac", "com.brave.Browser", "com.apple.Safari"].contains(id),
+ guard ["com.google.Chrome", "company.thebrowser.Browser", "com.ardia.browser", "com.microsoft.edgemac", "com.brave.Browser", "com.apple.Safari"].contains(id),
!NSRunningApplication.runningApplications(withBundleIdentifier: id).isEmpty else { return nil }
let src = "tell application id \"\(id)\" to get " + (safari ? "name of current tab of front window" : "title of active tab of front window")
var err: NSDictionary?
@@ -356,7 +356,13 @@ func callWindows(_ app: AXUIElement, _ id: String) -> [AXUIElement] {
}
}
// a browser: only windows whose front tab is a Meet call
- return all.filter { w in (axText(axAttr(w, kAXTitleAttribute)) ?? "").range(of: #"\bMeet\b"#, options: .regularExpression) != nil }
+ let meet = all.filter { w in (axText(axAttr(w, kAXTitleAttribute)) ?? "").range(of: #"\bMeet\b"#, options: .regularExpression) != nil }
+ if !meet.isEmpty || !chromium.contains(id) { return meet }
+ // Ardia names its windows "Ardia": the Meet words are only in the tab title, which AppleScript reads, and the tab
+ // belongs to the focused window (#123)
+ guard let title = browserTitle(id), title.range(of: #"\bMeet\b"#, options: .regularExpression) != nil,
+ let w = axAttr(app, kAXFocusedWindowAttribute), CFGetTypeID(w) == AXUIElementGetTypeID() else { return [] }
+ return [w as! AXUIElement]
}
func watchCalls(every: Int, ids: [String]) {
@@ -387,6 +393,11 @@ func watchCalls(every: Int, ids: [String]) {
}
if let (target, app, wins) = found, let id = target.bundleIdentifier {
askTree(app, target, force: true)
+ // Asking the whole browser can still leave only its tabs and sidebar; asking the window itself makes it build
+ // the page (tested on a live Meet call in Ardia, #123). It is one cheap call, so every reading asks again.
+ if chromium.contains(id) && !id.hasPrefix("com.microsoft.teams") {
+ for w in wins.prefix(4) { AXUIElementSetAttributeValue(w, "AXManualAccessibility" as CFString, kCFBooleanTrue) }
+ }
let zoom = id == "us.zoom.xos"
var budget = zoom ? 1500 : 4000
let out = wins.prefix(4).map { w -> [String: Any] in
diff --git a/app/test/macTeamsTree.test.ts b/app/test/macTeamsTree.test.ts
index de1a4ecf..83c9f4b3 100644
--- a/app/test/macTeamsTree.test.ts
+++ b/app/test/macTeamsTree.test.ts
@@ -30,5 +30,12 @@ describe('call-watch on the Teams desktop app (#111)', () => {
expect(ask).toContain('"AXEnhancedUserInterface" as CFString, kCFBooleanTrue')
expect(swift).toMatch(/readDataToEndOfFile\(\); DispatchQueue\.main\.sync \{ resetTrees\(\) \}; exit\(0\)/)
})
+ it("reads a Meet tab in a browser whose window title is only the browser's name, and asks the window itself for the page (#123)", () => {
+ expect(swift).toMatch(/"com\.ardia\.browser", "com\.microsoft\.edgemac", "com\.brave\.Browser", "com\.apple\.Safari"\]\.contains\(id\)/)
+ const windows = swift.slice(swift.indexOf('func callWindows'), swift.indexOf('func watchCalls'))
+ expect(windows).toContain('browserTitle(id)')
+ expect(windows).toContain('kAXFocusedWindowAttribute')
+ expect(swift).toMatch(/for w in wins\.prefix\(4\) \{ AXUIElementSetAttributeValue\(w, "AXManualAccessibility"/)
+ })
})