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
Bring the note in front of Safari when the recorder pill is clicked, even if macOS keeps Safari active
christianmat0afd18fe4cef
diff --git a/app/src/main/index.ts b/app/src/main/index.tsindex b4073431..e7b3aaeb 100644--- a/app/src/main/index.ts+++ b/app/src/main/index.ts@@ -122,7 +122,7 @@ function createWindow() {webPreferences: { preload: join(__dirname, '../preload/index.cjs'), sandbox: false, ...(BACKGROUND ? { backgroundThrottling: false } : {}) },})presentMain = keepMainWindow(win, { background: BACKGROUND, canClose: () => allowQuit, activate: () => app.focus({ steal: true }),- closeTo: () => closeAction(process.platform, trayShown()), glass: process.platform === 'darwin' })+ closeTo: () => closeAction(process.platform, trayShown()), glass: process.platform === 'darwin', lift: process.platform === 'darwin' })if (process.platform !== 'darwin') {win.setMenuBarVisibility(false)// the window buttons follow light and dark modediff --git a/app/src/main/mainWindow.ts b/app/src/main/mainWindow.tsindex 1f1c2838..6cd7411f 100644--- a/app/src/main/mainWindow.ts+++ b/app/src/main/mainWindow.ts@@ -8,7 +8,9 @@ import type { BrowserWindow } from 'electron'export const closeAction = (os: string, trayShown: boolean): 'hide' | 'minimize' => (os === 'darwin' || trayShown ? 'hide' : 'minimize')/** Closing keeps the renderer alive; only the completed save/quit path may destroy it. */-export function keepMainWindow(window: BrowserWindow, d: { background: boolean; canClose(): boolean; activate(): void; closeTo?(): 'hide' | 'minimize'; glass?: boolean }) {+export function keepMainWindow(window: BrowserWindow, d: { background: boolean; canClose(): boolean; activate(): void; closeTo?(): 'hide' | 'minimize'; glass?: boolean+ /** a Mac: floats the window for a moment when brought forward, see show() */+ lift?: boolean }) {let ready = false, requested = false, foreground = falseconst show = (bringForward = false) => {if (d.background || window.isDestroyed()) return@@ -16,9 +18,14 @@ export function keepMainWindow(window: BrowserWindow, d: { background: boolean;if (!ready) returnrequested = falseif (window.isMinimized()) window.restore()+ // macOS may refuse to switch apps (the pill is a non-activating panel, Safari stays active); the window then+ // landed behind Safari, out of sight. Floating it for the show puts it on top either way.+ const lift = foreground && d.lift === true+ if (lift) window.setAlwaysOnTop(true)window.show()if (foreground) { window.moveTop(); d.activate() }window.focus()+ if (lift) window.setAlwaysOnTop(false)foreground = false}window.once('ready-to-show', () => {diff --git a/app/test/mainWindow.test.ts b/app/test/mainWindow.test.tsindex 6fde1ce8..bd084d89 100644--- a/app/test/mainWindow.test.ts+++ b/app/test/mainWindow.test.ts@@ -3,11 +3,11 @@ import type { BrowserWindow } from 'electron'import { expect, it, vi } from 'vitest'import { closeAction, keepMainWindow } from '../src/main/mainWindow'-function fixture(background = false, more: { closeTo?(): 'hide' | 'minimize'; glass?: boolean } = {}) {+function fixture(background = false, more: { closeTo?(): 'hide' | 'minimize'; glass?: boolean; lift?: boolean } = {}) {let quitting = falseconst window = Object.assign(new EventEmitter(), {isDestroyed: vi.fn(() => false), isMinimized: vi.fn(() => false),- hide: vi.fn(), minimize: vi.fn(), show: vi.fn(), focus: vi.fn(), restore: vi.fn(), moveTop: vi.fn(), setBackgroundColor: vi.fn(),+ hide: vi.fn(), minimize: vi.fn(), show: vi.fn(), focus: vi.fn(), restore: vi.fn(), moveTop: vi.fn(), setBackgroundColor: vi.fn(), setAlwaysOnTop: vi.fn(),})const activate = vi.fn()const show = keepMainWindow(window as unknown as BrowserWindow, { background, canClose: () => quitting, activate, ...more })@@ -69,3 +69,23 @@ it('only a window with native glass (a Mac) turns clear after first paint', () =window.emit('ready-to-show')expect(window.setBackgroundColor).not.toHaveBeenCalled()})++it('on a Mac, brought forward from the pill or a card, rises above the app in front even when macOS refuses to switch apps, then floats no longer', () => {+ const { window, show, activate } = fixture(false, { lift: true })+ window.emit('ready-to-show')+ show(true)+ expect(window.setAlwaysOnTop.mock.calls).toEqual([[true], [false]])+ const [up, down] = window.setAlwaysOnTop.mock.invocationCallOrder+ expect(up).toBeLessThan(window.show.mock.invocationCallOrder[0])+ expect(down).toBeGreaterThan(activate.mock.invocationCallOrder[0])+ expect(down).toBeGreaterThan(window.focus.mock.invocationCallOrder[0])+})++it('a plain show, Windows and Linux never float the window', () => {+ const mac = fixture(false, { lift: true })+ mac.window.emit('ready-to-show'); mac.show()+ expect(mac.window.setAlwaysOnTop).not.toHaveBeenCalled()+ const other = fixture()+ other.window.emit('ready-to-show'); other.show(true)+ expect(other.window.setAlwaysOnTop).not.toHaveBeenCalled()+})