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.
TypeScript ai-meeting-assistantai-notetakerelectrongranola-alternativelinuxllama-cpplocal-ailocal-firstmacosmcpmeeting-minutesmeeting-notesoffline-firstopen-sourceprivacyspeech-to-texttranscriptionwhisperwhisper-cppwindows
Auto end (Windows): a recording, also one started from the agenda, stops once the Teams call window is gone and both sides are quiet, as on the Mac; a call window that is only minimised or on another desktop is not gone (#83)
christianmat0537aeae979f
diff --git a/app/native/yogurt-system/Cargo.toml b/app/native/yogurt-system/Cargo.tomlindex 50759ef4..34d1dfce 100644--- a/app/native/yogurt-system/Cargo.toml+++ b/app/native/yogurt-system/Cargo.toml@@ -17,6 +17,7 @@ serde_json = "=1.0.140"winreg = "=0.52.0"windows = { version = "=0.58.0", features = ["Win32_Foundation",+ "Win32_Graphics_Dwm","Win32_Media_Audio","Win32_System_Com","Win32_System_Com_StructuredStorage",diff --git a/app/native/yogurt-system/src/call.rs b/app/native/yogurt-system/src/call.rsindex 5a07c855..8ebb7c4a 100644--- a/app/native/yogurt-system/src/call.rs+++ b/app/native/yogurt-system/src/call.rs@@ -85,6 +85,29 @@ pub fn to_read<T>(mut windows: Vec<(u64, T)>, last: Option<u64>) -> (Vec<(u64, T}}+/// What a reading of the window that was the call says about it+#[derive(Debug, PartialEq)]+pub enum Look {+ /// still the call+ Call,+ /// it did not answer in time: nothing can be told+ Slow,+ /// minimised or on another desktop: Yogurt must not take that for the call ending (#83)+ Hidden,+ /// open and in sight, with no call controls: the call is over+ Gone,+}++#[cfg_attr(not(windows), allow(dead_code))]+pub fn look(tree: Option<&Value>, out_of_sight: bool) -> Look {+ match tree {+ Some(t) if is_call_tree(t) => Look::Call,+ _ if out_of_sight => Look::Hidden,+ None => Look::Slow,+ Some(_) => Look::Gone,+ }+}+pub fn now_ms() -> u64 {SystemTime::now().duration_since(UNIX_EPOCH).map(|d| d.as_millis() as u64).unwrap_or(0)}@@ -156,6 +179,18 @@ mod tests {assert_eq!(to_read(wins.clone(), None), (wins, false));}+ #[test]+ fn a_minimised_call_window_is_hidden_not_gone() {+ let call = json!({ "r": "frame", "k": [{ "r": "button", "t": "Leave", "i": "hangup-button" }] });+ let after = json!({ "r": "frame", "k": [{ "r": "button", "t": "Rejoin" }] });+ assert_eq!(look(Some(&call), false), Look::Call);+ assert_eq!(look(Some(&call), true), Look::Call);+ assert_eq!(look(Some(&after), true), Look::Hidden);+ assert_eq!(look(None, true), Look::Hidden);+ assert_eq!(look(None, false), Look::Slow);+ assert_eq!(look(Some(&after), false), Look::Gone);+ }+#[test]fn the_hang_up_id_is_a_call_in_any_language() {// Teams in Portuguese labels Leave "Sair": its page id stays "hangup-button", as the Mac reader matches (#83)diff --git a/app/native/yogurt-system/src/win.rs b/app/native/yogurt-system/src/win.rsindex 01ccc444..631292ed 100644--- a/app/native/yogurt-system/src/win.rs+++ b/app/native/yogurt-system/src/win.rs@@ -12,7 +12,8 @@ use windows::Win32::Media::Audio::{use windows::Win32::System::Com::{CoCreateInstance, CoInitializeEx, CLSCTX_ALL, COINIT_MULTITHREADED};use windows::Win32::System::Diagnostics::ToolHelp::{CreateToolhelp32Snapshot, Process32FirstW, Process32NextW, PROCESSENTRY32W, TH32CS_SNAPPROCESS};use windows::Win32::System::Threading::{OpenProcess, QueryFullProcessImageNameW, PROCESS_NAME_WIN32, PROCESS_QUERY_LIMITED_INFORMATION};-use windows::Win32::UI::WindowsAndMessaging::{EnumWindows, GetForegroundWindow, GetWindowTextW, GetWindowThreadProcessId, IsWindowVisible};+use windows::Win32::Graphics::Dwm::{DwmGetWindowAttribute, DWMWA_CLOAKED};+use windows::Win32::UI::WindowsAndMessaging::{EnumWindows, GetForegroundWindow, GetWindowTextW, GetWindowThreadProcessId, IsIconic, IsWindowVisible};use winreg::enums::HKEY_CURRENT_USER;use winreg::RegKey;@@ -180,3 +181,13 @@ pub fn window_title(id: &str) -> Option<String> {found.into_iter().map(|(h, pid, title)| (h, procs.get(&pid).is_some_and(|p| parse::exe_id(&p.exe) == id), title)).collect();parse::pick_window(&windows, (active != 0).then_some(active))}++/** Whether a window is minimised, or cloaked (on another virtual desktop): there, but out of sight */+pub fn out_of_sight(hwnd: u64) -> bool {+ let h = HWND(hwnd as usize as *mut core::ffi::c_void);+ unsafe {+ let mut cloaked = 0u32;+ let got = DwmGetWindowAttribute(h, DWMWA_CLOAKED, &mut cloaked as *mut u32 as *mut core::ffi::c_void, std::mem::size_of::<u32>() as u32);+ IsIconic(h).as_bool() || (got.is_ok() && cloaked != 0)+ }+}diff --git a/app/native/yogurt-system/src/wincalls.rs b/app/native/yogurt-system/src/wincalls.rsindex a425eabf..03fcd58c 100644--- a/app/native/yogurt-system/src/wincalls.rs+++ b/app/native/yogurt-system/src/wincalls.rs@@ -16,7 +16,7 @@ use windows::Win32::UI::Accessibility::{UIA_HelpTextPropertyId, UIA_NamePropertyId,};-use crate::call::{call_window, is_call_tree, kind, now_ms, to_read, Kind};+use crate::call::{call_window, is_call_tree, kind, look, now_ms, to_read, Kind, Look};use crate::parse;/// at most this many call windows of the app per reading@@ -179,11 +179,14 @@ fn read_once(u: &Uia, ids: &[String], last: &mut Option<u64>) -> Value {let mut checked = None;if alone {let (hwnd, (id, title)) = &first[0];- match u.tree(*hwnd) {- Some(tree) if is_call_tree(&tree) => return json!({ "t": t, "app": id, "windows": [{ "title": title, "tree": tree }] }),+ let tree = u.tree(*hwnd);+ match look(tree.as_ref(), crate::win::out_of_sight(*hwnd)) {+ Look::Call => return json!({ "t": t, "app": id, "windows": [{ "title": title, "tree": tree }] }),// it did not answer in time: the other windows would be as slow, so this reading is skipped- None => return json!({ "t": t, "error": "slow-call-window" }),- Some(_) => {+ Look::Slow => return json!({ "t": t, "error": "slow-call-window" }),+ // minimised or on another desktop: kept, and Yogurt is told the call is not over (#83: auto end on Windows)+ Look::Hidden => return json!({ "t": t, "error": "no-call-window", "hidden": true }),+ Look::Gone => {*last = None;checked = Some(*hwnd);}diff --git a/app/src/main/index.ts b/app/src/main/index.tsindex a99fcccc..6f2f8e1a 100644--- a/app/src/main/index.ts+++ b/app/src/main/index.ts@@ -336,8 +336,9 @@ let recordingControls: { start(o: { eventId?: string; title?: string }): Promise/** 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[] = () => []-/** the meeting's call window as the call names reader sees it (set once call names start). Mac only: its reader also- * says when the call window is just on another desktop, so that is never taken for the call ending */+/** the meeting's call window as the call names reader sees it (set once call names start). Mac and Windows: their+ * readers also say when the call window is just minimised or on another desktop, so that is never taken for the call+ * ending (#83: on Windows a recording started from the agenda never ended by itself) */let callWindowOf: (meetingId: string) => { goneMs: number } | null = () => null/** fake mode's hooks reach the store and the notes through these */@@ -648,7 +649,7 @@ app.whenReady().then(() => {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, micPids: (app) => micPidsNow(app),})- if (process.platform === 'darwin') callWindowOf = (id) => callNames.callWindow(id)+ if (process.platform === 'darwin' || process.platform === 'win32') callWindowOf = (id) => callNames.callWindow(id)// Windows and Linux: whisper left the graphics card in a meeting, so the speed check (timed with it) runs again next startonWhisperGpuOff(() => speedStore(speedFile()).forget())hookTranscription({ store, modelPath: () => setup.installed()?.asr, send: (seg) => {diff --git a/app/test/callNames.test.ts b/app/test/callNames.test.tsindex 3f99fe77..48d2765c 100644--- a/app/test/callNames.test.ts+++ b/app/test/callNames.test.ts@@ -1,6 +1,6 @@import { afterEach, describe, expect, it, vi } from 'vitest'import { EventEmitter } from 'node:events'-import { mkdtempSync, rmSync } from 'node:fs'+import { mkdtempSync, readFileSync, rmSync } from 'node:fs'import { tmpdir } from 'node:os'import { join } from 'node:path'import { openStore, type Meeting, type Store } from '../src/main/store'@@ -408,6 +408,15 @@ describe('hookCallNames', () => {// #auto-end: Christian's Zoom call (Nov 23) never stopped by itself. A call window seen and then gone is a second sign the// call ended, beside the mic, which Zoom can keep after a meeting.+describe('auto end by the call window on Windows (#83)', () => {+ it("ends a call on Windows too once its window is gone: the Windows reader says when the window is only minimised or on another desktop", () => {+ const main = readFileSync(join(__dirname, '../src/main/index.ts'), 'utf8')+ expect(main).toMatch(/process\.platform === 'darwin' \|\| process\.platform === 'win32'\) callWindowOf = /)+ const rust = readFileSync(join(__dirname, '../native/yogurt-system/src/wincalls.rs'), 'utf8')+ expect(rust).toContain('Look::Hidden => return json!({ "t": t, "error": "no-call-window", "hidden": true })')+ })+})+describe('callWindow: the call window seen, then gone', () => {const gone = (t: number, extra: Partial<WatchLine> = {}): WatchLine => ({ t, app: 'us.zoom.xos', error: 'no-call-window', ...extra })it('a Zoom meeting window with people that goes away counts how long it has been gone, and says so in the log', () => {