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 (Meet in Ardia on Mac): the call window carries the Meet tab's title, so its names are read (#123)

Lars Bückeraeaf337c2652
diff --git a/app/native/yogurt-mac/main.swift b/app/native/yogurt-mac/main.swift
index 30891e71..c3e0a0ad 100644
--- a/app/native/yogurt-mac/main.swift
+++ b/app/native/yogurt-mac/main.swift
@@ -334,35 +334,38 @@ func hasCallControl(_ w: AXUIElement, budget: Int = 1500) -> Bool {
return false
}
-func callWindows(_ app: AXUIElement, _ id: String) -> [AXUIElement] {
+func isMeetTitle(_ t: String) -> Bool { t.range(of: #"\bMeet\b"#, options: .regularExpression) != nil }
+
+/// The call windows, and the tab title when the one window was chosen by it because its accessibility title does not say Meet (Ardia's is "Ardia").
+func callWindows(_ app: AXUIElement, _ id: String) -> (wins: [AXUIElement], tab: String?) {
let all = (axAttr(app, kAXWindowsAttribute) as? [AXUIElement]) ?? []
if id == "us.zoom.xos" {
- return all.filter { w in
+ return (all.filter { w in
let ident = axText(axAttr(w, kAXIdentifierAttribute)) ?? "", title = axText(axAttr(w, kAXTitleAttribute)) ?? ""
// while the person shares their screen Zoom hides the meeting window and shows its floating video window
// ("zoom floating video window"), which still shows the tiles and who is talking
return ident.hasPrefix("zm.meeting") || title.hasPrefix("Zoom Meeting") || title.hasPrefix("Zoom Webinar") || title == "zoom floating video window"
- }
+ }, nil)
}
// Teams keeps its chat and calendar in windows shaped like the call's: only a window with a call control (Leave,
// Mute) is a call, so an open chat can't hide a call in another app (#72). The same controls as Linux (calls.rs).
- if id.hasPrefix("com.microsoft.teams") { return all.filter { hasCallControl($0) } }
+ if id.hasPrefix("com.microsoft.teams") { return (all.filter { hasCallControl($0) }, nil) }
// Webex's meeting surfaces have stable accessibility identifiers; exclude its home window so it cannot hide another
// call app when a recording was started by hand.
if id == "Cisco-Systems.Spark" || id == "com.cisco.webexmeetingsapp" {
- return all.filter { w in
+ return (all.filter { w in
let ident = axText(axAttr(w, kAXIdentifierAttribute)) ?? ""
return ident == "FloatingMediaWindow" || ident == "PopOutWindow"
- }
+ }, nil)
}
// a browser: only windows whose front tab is a Meet call
- 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 }
+ let meet = all.filter { w in isMeetTitle(axText(axAttr(w, kAXTitleAttribute)) ?? "") }
+ if !meet.isEmpty || !chromium.contains(id) { return (meet, nil) }
// 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]
+ guard let title = browserTitle(id), isMeetTitle(title),
+ let w = axAttr(app, kAXFocusedWindowAttribute), CFGetTypeID(w) == AXUIElementGetTypeID() else { return ([], nil) }
+ return ([w as! AXUIElement], title)
}
func watchCalls(every: Int, ids: [String]) {
@@ -383,15 +386,15 @@ func watchCalls(every: Int, ids: [String]) {
let front = NSWorkspace.shared.frontmostApplication?.processIdentifier
let running = ids.compactMap { NSRunningApplication.runningApplications(withBundleIdentifier: $0).first }
.sorted { a, _ in a.processIdentifier == front }
- var found: (NSRunningApplication, AXUIElement, [AXUIElement])?
+ var found: (NSRunningApplication, AXUIElement, [AXUIElement], String?)?
for r in running {
let app = AXUIElementCreateApplication(r.processIdentifier)
AXUIElementSetMessagingTimeout(app, 0.3)
askTree(app, r)
- let wins = callWindows(app, r.bundleIdentifier ?? "")
- if !wins.isEmpty { found = (r, app, wins); break }
+ let (wins, tab) = callWindows(app, r.bundleIdentifier ?? "")
+ if !wins.isEmpty { found = (r, app, wins, tab); break }
}
- if let (target, app, wins) = found, let id = target.bundleIdentifier {
+ if let (target, app, wins, tab) = 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.
@@ -400,9 +403,15 @@ func watchCalls(every: Int, ids: [String]) {
}
let zoom = id == "us.zoom.xos"
var budget = zoom ? 1500 : 4000
+ // the tab title belongs to the window that was focused when it was read
+ let focused = axAttr(app, kAXFocusedWindowAttribute)
let out = wins.prefix(4).map { w -> [String: Any] in
var o: [String: Any] = ["tree": axCopy(w, depth: 0, maxDepth: zoom ? 14 : 40, budget: &budget, zoom: zoom)]
- if let x = axText(axAttr(w, kAXTitleAttribute)) { o["title"] = x }
+ // The parser skips a window whose title does not say Meet. Ardia's accessibility title is the app name, so the tab title is what gets written.
+ let axTitle = axText(axAttr(w, kAXTitleAttribute)) ?? ""
+ var title = axTitle
+ if !isMeetTitle(axTitle), let tab, let focused, CFEqual(w, focused) { title = tab }
+ if !title.isEmpty { o["title"] = title }
if let x = axText(axAttr(w, kAXIdentifierAttribute)) { o["id"] = x }
return o
}
diff --git a/app/test/macTeamsTree.test.ts b/app/test/macTeamsTree.test.ts
index 83c9f4b3..25d33088 100644
--- a/app/test/macTeamsTree.test.ts
+++ b/app/test/macTeamsTree.test.ts
@@ -35,6 +35,9 @@ describe('call-watch on the Teams desktop app (#111)', () => {
const windows = swift.slice(swift.indexOf('func callWindows'), swift.indexOf('func watchCalls'))
expect(windows).toContain('browserTitle(id)')
expect(windows).toContain('kAXFocusedWindowAttribute')
+ expect(windows).toContain('([w as! AXUIElement], title)')
+ expect(swift.slice(swift.indexOf('func watchCalls'))).toContain('CFEqual(w, focused)')
+ expect(swift).not.toContain('meetTabTitle')
expect(swift).toMatch(/for w in wins\.prefix\(4\) \{ AXUIElementSetAttributeValue\(w, "AXManualAccessibility"/)
})
})