Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat: full meeting note flow — notification, window snap, live transcription

Gabriel Stein5cc0ee91b899
diff --git a/main.js b/main.js
index 3a26ae681..fc2c93411 100644
--- a/main.js
+++ b/main.js
@@ -253,7 +253,9 @@ function initializeCoreManagers() {
meetingDetectionEngine = new MeetingDetectionEngine(
googleCalendarManager,
new MeetingProcessDetector(),
- new AudioActivityDetector()
+ new AudioActivityDetector(),
+ windowManager,
+ databaseManager
);
updateManager = new UpdateManager();
windowsKeyManager = new WindowsKeyManager();
diff --git a/preload.js b/preload.js
index f77684a67..04a06779c 100644
--- a/preload.js
+++ b/preload.js
@@ -489,4 +489,15 @@ contextBridge.exposeInMainWorld("electronAPI", {
"meeting-detected-start-recording",
(callback) => (_event, data) => callback(data)
),
+ onMeetingNotificationData: registerListener(
+ "meeting-notification-data",
+ (callback) => (_event, data) => callback(data)
+ ),
+ getMeetingNotificationData: () => ipcRenderer.invoke("get-meeting-notification-data"),
+ meetingNotificationRespond: (detectionId, action) =>
+ ipcRenderer.invoke("meeting-notification-respond", detectionId, action),
+ onNavigateToMeetingNote: registerListener(
+ "navigate-to-meeting-note",
+ (callback) => (_event, data) => callback(data)
+ ),
});
diff --git a/src/App.jsx b/src/App.jsx
index 413b9568d..7864403f6 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -9,7 +9,6 @@ import { useWindowDrag } from "./hooks/useWindowDrag";
import { useAudioRecording } from "./hooks/useAudioRecording";
import { useAuth } from "./hooks/useAuth";
import { useSettingsStore } from "./stores/settingsStore";
-import { useMeetingRecording } from "./hooks/useMeetingRecording";
// Sound Wave Icon Component (for idle/hover states)
const SoundWaveIcon = ({ size = 16 }) => {
@@ -81,8 +80,6 @@ export default function App() {
const { hotkey } = useHotkey();
const { isDragging, handleMouseDown, handleMouseUp } = useWindowDrag();
const { isSignedIn } = useAuth();
- useMeetingRecording();
-
const [dragStartPos, setDragStartPos] = useState(null);
const [hasDragged, setHasDragged] = useState(false);
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 348337b8e..86810c40a 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -45,6 +45,11 @@ export default function ControlPanel() {
const [showReferrals, setShowReferrals] = useState(false);
const [showCloudMigrationBanner, setShowCloudMigrationBanner] = useState(false);
const [activeView, setActiveView] = useState<ControlPanelView>("home");
+ const [meetingRecordingRequest, setMeetingRecordingRequest] = useState<{
+ noteId: number;
+ folderId: number;
+ event: any;
+ } | null>(null);
const [gpuAccelAvailable, setGpuAccelAvailable] = useState<{ cuda: boolean; vulkan: boolean }>({
cuda: false,
vulkan: false,
@@ -179,6 +184,16 @@ export default function ControlPanel() {
detect();
}, [useLocalWhisper, localTranscriptionProvider, useReasoningModel, gpuBannerDismissed]);
+ useEffect(() => {
+ const cleanup = window.electronAPI?.onNavigateToMeetingNote?.((data) => {
+ setActiveFolderId(data.folderId);
+ setActiveNoteId(data.noteId);
+ setActiveView("personal-notes");
+ setMeetingRecordingRequest(data);
+ });
+ return () => cleanup?.();
+ }, []);
+
const loadTranscriptions = async () => {
try {
setIsLoading(true);
@@ -508,6 +523,8 @@ export default function ControlPanel() {
setSettingsSection(section);
setShowSettings(true);
}}
+ meetingRecordingRequest={meetingRecordingRequest}
+ onMeetingRecordingRequestHandled={() => setMeetingRecordingRequest(null)}
/>
</Suspense>
)}
diff --git a/src/components/MeetingNotificationOverlay.tsx b/src/components/MeetingNotificationOverlay.tsx
new file mode 100644
index 000000000..4e3f83b93
--- /dev/null
+++ b/src/components/MeetingNotificationOverlay.tsx
@@ -0,0 +1,93 @@
+import { useState, useEffect, useCallback } from "react";
+import { X } from "lucide-react";
+
+interface NotificationData {
+ detectionId: string;
+ source: string;
+ title: string;
+ body: string;
+}
+
+export default function MeetingNotificationOverlay() {
+ const [data, setData] = useState<NotificationData | null>(null);
+ const [isVisible, setIsVisible] = useState(false);
+
+ useEffect(() => {
+ const cleanup = window.electronAPI?.onMeetingNotificationData?.(
+ (incoming: NotificationData) => {
+ setData(incoming);
+ setTimeout(() => setIsVisible(true), 50);
+ }
+ );
+
+ window.electronAPI?.getMeetingNotificationData?.().then((pulled: NotificationData | null) => {
+ if (pulled && !data) {
+ setData(pulled);
+ setTimeout(() => setIsVisible(true), 50);
+ }
+ });
+
+ return () => cleanup?.();
+ }, []);
+
+ const respond = useCallback(
+ async (action: string) => {
+ if (!data) return;
+ setIsVisible(false);
+ await new Promise((r) => setTimeout(r, 200));
+ window.electronAPI?.meetingNotificationRespond?.(data.detectionId, action);
+ },
+ [data]
+ );
+
+ return (
+ <div className="meeting-notification-window w-full h-full bg-transparent p-2">
+ <div
+ className={[
+ "bg-card/95 dark:bg-surface-2/95 backdrop-blur-xl",
+ "border border-border/40 dark:border-border-subtle/40",
+ "rounded-xl shadow-lg p-2.5",
+ "transition-all duration-300 ease-out",
+ isVisible
+ ? "translate-x-0 opacity-100 scale-100"
+ : "translate-x-[120%] opacity-0 scale-95",
+ ].join(" ")}
+ >
+ <div className="flex items-center gap-2.5">
+ <div className="shrink-0 bg-primary/10 rounded-md p-1">
+ <svg viewBox="0 0 1024 1024" className="w-4.5 h-4.5">
+ <rect width="1024" height="1024" rx="241" fill="#2056DF" />
+ <circle cx="512" cy="512" r="314" fill="#2056DF" stroke="white" strokeWidth="74" />
+ <path d="M512 383V641" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ <path d="M627 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ <path d="M397 457V568" stroke="white" strokeWidth="74" strokeLinecap="round" />
+ </svg>
+ </div>
+
+ <div className="flex-1 min-w-0">
+ <p className="text-[12px] font-semibold text-foreground leading-tight truncate">
+ {data?.title ?? "Meeting Detected"}
+ </p>
+ <p className="text-[11px] text-muted-foreground leading-tight mt-0.5">
+ {data?.body ?? "Want to take notes?"}
+ </p>
+ </div>
+
+ <button
+ onClick={() => respond("start")}
+ className="shrink-0 bg-primary text-primary-foreground hover:bg-primary/90 text-[11px] font-medium px-2.5 py-1 rounded-md transition-colors"
+ >
+ Start Recording
+ </button>
+
+ <button
+ onClick={() => respond("dismiss")}
+ className="shrink-0 text-muted-foreground/60 hover:text-foreground transition-colors p-0.5"
+ >
+ <X className="w-3.5 h-3.5" />
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsx
index 1d54cae2b..7001c4e31 100644
--- a/src/components/notes/NoteEditor.tsx
+++ b/src/components/notes/NoteEditor.tsx
@@ -52,6 +52,11 @@ interface NoteEditorProps {
actionPicker?: React.ReactNode;
actionProcessingState?: ActionProcessingState;
actionName?: string | null;
+ isMeetingTranscribing?: boolean;
+ meetingTranscript?: string;
+ meetingPartialTranscript?: string;
+ meetingEvent?: { summary: string };
+ onStopMeetingRecording?: () => void;
}
interface DictationRange {
@@ -144,6 +149,11 @@ export default function NoteEditor({
actionPicker,
actionProcessingState,
actionName,
+ isMeetingTranscribing,
+ meetingTranscript,
+ meetingPartialTranscript,
+ meetingEvent,
+ onStopMeetingRecording,
}: NoteEditorProps) {
const { t } = useTranslation();
const [viewMode, setViewMode] = useState<"raw" | "enhanced">("raw");
@@ -695,6 +705,24 @@ export default function NoteEditor({
</div>
</div>
+ {isMeetingTranscribing && meetingEvent && (
+ <div className="flex items-center gap-2 px-4 py-1.5 border-b border-destructive/10 bg-destructive/3">
+ <span className="relative flex h-2 w-2">
+ <span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-destructive/75" />
+ <span className="relative inline-flex rounded-full h-2 w-2 bg-destructive" />
+ </span>
+ <span className="text-[11px] font-medium text-destructive/70 flex-1 truncate">
+ Recording: {meetingEvent.summary}
+ </span>
+ <button
+ onClick={onStopMeetingRecording}
+ className="text-[11px] font-medium text-destructive/60 hover:text-destructive transition-colors"
+ >
+ Stop
+ </button>
+ </div>
+ )}
+
<div className="flex-1 relative min-h-0">
<div className="h-full overflow-y-auto">
{viewMode === "enhanced" && enhancement ? (
@@ -726,6 +754,24 @@ export default function NoteEditor({
actionPicker={actionPicker}
/>
</div>
+
+ {(isMeetingTranscribing || meetingTranscript) && (
+ <div className="border-t border-border/50 bg-surface-0/50 dark:bg-surface-1/30">
+ <div className="px-4 py-1.5 flex items-center gap-1.5">
+ <span className="text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/50">
+ Transcript
+ </span>
+ </div>
+ <div className="px-4 pb-3 max-h-32 overflow-y-auto">
+ <p className="text-xs text-muted-foreground/70 leading-relaxed whitespace-pre-wrap">
+ {meetingTranscript}
+ {meetingPartialTranscript && (
+ <span className="text-muted-foreground/40">{meetingPartialTranscript}</span>
+ )}
+ </p>
+ </div>
+ </div>
+ )}
</div>
);
}
diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsx
index 943398fed..0a89384fa 100644
--- a/src/components/notes/PersonalNotesView.tsx
+++ b/src/components/notes/PersonalNotesView.tsx
@@ -31,6 +31,7 @@ import {
setActiveNoteId,
setActiveFolderId,
} from "../../stores/noteStore";
+import { useMeetingTranscription } from "../../hooks/useMeetingTranscription";
import { useNotesOnboarding } from "../../hooks/useNotesOnboarding";
import NotesOnboarding from "./NotesOnboarding";
import RealtimeTranscriptionBanner from "./RealtimeTranscriptionBanner";
@@ -44,9 +45,15 @@ function makeContentHash(content: string): string {
interface PersonalNotesViewProps {
onOpenSettings?: (section: string) => void;
+ meetingRecordingRequest?: { noteId: number; folderId: number; event: any } | null;
+ onMeetingRecordingRequestHandled?: () => void;
}
-export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewProps) {
+export default function PersonalNotesView({
+ onOpenSettings,
+ meetingRecordingRequest,
+ onMeetingRecordingRequestHandled,
+}: PersonalNotesViewProps) {
const { t } = useTranslation();
const notes = useNotes();
const activeNoteId = useActiveNoteId();
@@ -74,6 +81,14 @@ export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewP
complete: completeOnboarding,
} = useNotesOnboarding();
+ const {
+ isTranscribing: isMeetingTranscribing,
+ transcript: meetingTranscript,
+ partialTranscript: meetingPartialTranscript,
+ startTranscription: startMeetingTranscription,
+ stopTranscription: stopMeetingTranscription,
+ } = useMeetingTranscription();
+
const {
folders,
folderCounts,
@@ -191,7 +206,7 @@ export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewP
);
const handleNewNote = useCallback(async () => {
- if (!activeFolderId || isMeetingsFolder) return;
+ if (!activeFolderId) return;
const result = await window.electronAPI.saveNote(
t("notes.list.untitledNote"),
"",
@@ -204,7 +219,7 @@ export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewP
setActiveNoteId(result.note.id);
loadFolders();
}
- }, [activeFolderId, isMeetingsFolder, loadFolders]);
+ }, [activeFolderId, loadFolders]);
const handleNotesAdded = useCallback(async () => {
if (activeFolderId) {
@@ -318,6 +333,26 @@ export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewP
[activeNoteId]
);
+ useEffect(() => {
+ if (!meetingRecordingRequest || activeNoteId !== meetingRecordingRequest.noteId) return;
+ startMeetingTranscription();
+ onMeetingRecordingRequestHandled?.();
+ }, [meetingRecordingRequest, activeNoteId]);
+
+ const prevTranscribingRef = useRef(false);
+
+ useEffect(() => {
+ if (
+ prevTranscribingRef.current &&
+ !isMeetingTranscribing &&
+ activeNoteId &&
+ meetingTranscript
+ ) {
+ window.electronAPI.updateNote(activeNoteId, { transcript: meetingTranscript });
+ }
+ prevTranscribingRef.current = isMeetingTranscribing;
+ }, [isMeetingTranscribing, activeNoteId, meetingTranscript]);
+
const editorNote = activeNote
? { ...activeNote, title: localTitle, content: localContent }
: null;
@@ -508,129 +543,123 @@ export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewP
<div className="mx-3 h-px bg-border/10 dark:bg-white/4 my-2" />
{/* Notes list */}
- {!isMeetingsFolder && (
- <>
- <div className="flex items-center justify-between px-3 py-1">
- <span className="text-xs font-medium uppercase tracking-wider text-foreground/50 dark:text-foreground/25">
- {t("notes.list.title")}
- </span>
- <Button
- variant="ghost"
- size="icon"
- onClick={handleNewNote}
- aria-label={t("notes.list.newNote")}
- className="h-5 w-5 rounded-md text-muted-foreground/50 dark:text-muted-foreground/30 hover:text-foreground/60 hover:bg-foreground/5"
- >
- <Plus size={13} />
- </Button>
- </div>
+ <div className="flex items-center justify-between px-3 py-1">
+ <span className="text-xs font-medium uppercase tracking-wider text-foreground/50 dark:text-foreground/25">
+ {t("notes.list.title")}
+ </span>
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={handleNewNote}
+ aria-label={t("notes.list.newNote")}
+ className="h-5 w-5 rounded-md text-muted-foreground/50 dark:text-muted-foreground/30 hover:text-foreground/60 hover:bg-foreground/5"
+ >
+ <Plus size={13} />
+ </Button>
+ </div>
- <div className="flex-1 overflow-y-auto">
- {isLoading ? (
- <div className="flex items-center justify-center py-8">
- <Loader2 size={12} className="animate-spin text-foreground/15" />
- </div>
- ) : notes.length === 0 ? (
- <div className="flex flex-col items-center justify-center py-8 px-4">
- <svg
- className="text-foreground dark:text-white mb-3"
- width="40"
- height="36"
- viewBox="0 0 40 36"
- fill="none"
- >
- <rect
- x="12"
- y="1"
- width="20"
- height="26"
- rx="2"
- transform="rotate(5 22 14)"
- fill="currentColor"
- fillOpacity={0.025}
- stroke="currentColor"
- strokeOpacity={0.06}
- />
- <rect
- x="8"
- y="3"
- width="20"
- height="26"
- rx="2"
- fill="currentColor"
- fillOpacity={0.04}
- stroke="currentColor"
- strokeOpacity={0.08}
- />
- <rect
- x="12"
- y="9"
- width="10"
- height="1.5"
- rx="0.75"
- fill="currentColor"
- fillOpacity={0.07}
- />
- <rect
- x="12"
- y="13"
- width="12"
- height="1.5"
- rx="0.75"
- fill="currentColor"
- fillOpacity={0.05}
- />
- <rect
- x="12"
- y="17"
- width="8"
- height="1.5"
- rx="0.75"
- fill="currentColor"
- fillOpacity={0.04}
- />
- </svg>
- <p className="text-xs text-foreground/50 dark:text-foreground/25 mb-3">
- {t("notes.empty.emptyFolder")}
- </p>
- <div className="flex flex-col gap-1.5 w-full max-w-36">
- <button
- onClick={handleNewNote}
- className="flex items-center justify-center gap-1.5 h-6 rounded-md bg-primary/8 dark:bg-primary/10 border border-primary/12 dark:border-primary/15 text-xs font-medium text-primary/70 hover:bg-primary/12 hover:text-primary hover:border-primary/20 transition-colors"
- >
- <Plus size={10} />
- {t("notes.empty.createNote")}
- </button>
- <button
- onClick={() => setShowAddNotesDialog(true)}
- className="flex items-center justify-center gap-1.5 h-6 rounded-md border border-foreground/8 dark:border-white/8 text-xs text-foreground/40 hover:text-foreground/60 hover:border-foreground/15 hover:bg-foreground/3 dark:hover:bg-white/3 transition-colors"
- >
- {t("notes.addToFolder.addExisting")}
- </button>
- </div>
- </div>
- ) : (
- notes.map((note) => (
- <NoteListItem
- key={note.id}
- note={note}
- isActive={note.id === activeNoteId}
- onClick={() => setActiveNoteId(note.id)}
- onDelete={handleDelete}
- folders={folders}
- currentFolderId={activeFolderId}
- onMoveToFolder={handleMoveToFolder}
- onCreateFolderAndMove={handleCreateFolderAndMove}
- dragHandlers={noteDragHandlers(note.id, note.title)}
- isDragging={dragState.draggingNoteId === note.id}
- />
- ))
- )}
+ <div className="flex-1 overflow-y-auto">
+ {isLoading ? (
+ <div className="flex items-center justify-center py-8">
+ <Loader2 size={12} className="animate-spin text-foreground/15" />
</div>
- </>
- )}
-
- {isMeetingsFolder && <div className="flex-1" />}
+ ) : notes.length === 0 ? (
+ <div className="flex flex-col items-center justify-center py-8 px-4">
+ <svg
+ className="text-foreground dark:text-white mb-3"
+ width="40"
+ height="36"
+ viewBox="0 0 40 36"
+ fill="none"
+ >
+ <rect
+ x="12"
+ y="1"
+ width="20"
+ height="26"
+ rx="2"
+ transform="rotate(5 22 14)"
+ fill="currentColor"
+ fillOpacity={0.025}
+ stroke="currentColor"
+ strokeOpacity={0.06}
+ />
+ <rect
+ x="8"
+ y="3"
+ width="20"
+ height="26"
+ rx="2"
+ fill="currentColor"
+ fillOpacity={0.04}
+ stroke="currentColor"
+ strokeOpacity={0.08}
+ />
+ <rect
+ x="12"
+ y="9"
+ width="10"
+ height="1.5"
+ rx="0.75"
+ fill="currentColor"
+ fillOpacity={0.07}
+ />
+ <rect
+ x="12"
+ y="13"
+ width="12"
+ height="1.5"
+ rx="0.75"
+ fill="currentColor"
+ fillOpacity={0.05}
+ />
+ <rect
+ x="12"
+ y="17"
+ width="8"
+ height="1.5"
+ rx="0.75"
+ fill="currentColor"
+ fillOpacity={0.04}
+ />
+ </svg>
+ <p className="text-xs text-foreground/50 dark:text-foreground/25 mb-3">
+ {t("notes.empty.emptyFolder")}
+ </p>
+ <div className="flex flex-col gap-1.5 w-full max-w-36">
+ <button
+ onClick={handleNewNote}
+ className="flex items-center justify-center gap-1.5 h-6 rounded-md bg-primary/8 dark:bg-primary/10 border border-primary/12 dark:border-primary/15 text-xs font-medium text-primary/70 hover:bg-primary/12 hover:text-primary hover:border-primary/20 transition-colors"
+ >
+ <Plus size={10} />
+ {t("notes.empty.createNote")}
+ </button>
+ <button
+ onClick={() => setShowAddNotesDialog(true)}
+ className="flex items-center justify-center gap-1.5 h-6 rounded-md border border-foreground/8 dark:border-white/8 text-xs text-foreground/40 hover:text-foreground/60 hover:border-foreground/15 hover:bg-foreground/3 dark:hover:bg-white/3 transition-colors"
+ >
+ {t("notes.addToFolder.addExisting")}
+ </button>
+ </div>
+ </div>
+ ) : (
+ notes.map((note) => (
+ <NoteListItem
+ key={note.id}
+ note={note}
+ isActive={note.id === activeNoteId}
+ onClick={() => setActiveNoteId(note.id)}
+ onDelete={handleDelete}
+ folders={folders}
+ currentFolderId={activeFolderId}
+ onMoveToFolder={handleMoveToFolder}
+ onCreateFolderAndMove={handleCreateFolderAndMove}
+ dragHandlers={noteDragHandlers(note.id, note.title)}
+ isDragging={dragState.draggingNoteId === note.id}
+ />
+ ))
+ )}
+ </div>
</div>
<div className="flex-1 flex flex-col min-w-0 min-h-0">
@@ -639,109 +668,7 @@ export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewP
onUpgrade={onOpenSettings ? () => onOpenSettings("plansBilling") : undefined}
/>
)}
- {isMeetingsFolder ? (
- <div className="flex flex-col items-center justify-center h-full -mt-6">
- <svg
- className="text-foreground dark:text-white mb-5"
- width="72"
- height="56"
- viewBox="0 0 72 56"
- fill="none"
- >
- <ellipse cx="36" cy="48" rx="24" ry="2" fill="currentColor" fillOpacity={0.03} />
- <circle
- cx="24"
- cy="20"
- r="7"
- fill="currentColor"
- fillOpacity={0.04}
- stroke="currentColor"
- strokeOpacity={0.08}
- />
- <path
- d="M13 40c0-6 5-11 11-11s11 5 11 11"
- fill="currentColor"
- fillOpacity={0.03}
- stroke="currentColor"
- strokeOpacity={0.06}
- />
- <circle
- cx="48"
- cy="20"
- r="7"
- fill="currentColor"
- fillOpacity={0.04}
- stroke="currentColor"
- strokeOpacity={0.08}
- />
- <path
- d="M37 40c0-6 5-11 11-11s11 5 11 11"
- fill="currentColor"
- fillOpacity={0.03}
- stroke="currentColor"
- strokeOpacity={0.06}
- />
- <rect
- x="16"
- y="6"
- width="14"
- height="8"
- rx="3"
- fill="currentColor"
- fillOpacity={0.04}
- stroke="currentColor"
- strokeOpacity={0.07}
- />
- <rect
- x="18.5"
- y="8.5"
- width="5"
- height="1"
- rx="0.5"
- fill="currentColor"
- fillOpacity={0.06}
- />
- <rect
- x="18.5"
- y="11"
- width="8"
- height="1"
- rx="0.5"
- fill="currentColor"
- fillOpacity={0.04}
- />
- <rect
- x="44"
- y="9"
- width="12"
- height="7"
- rx="2.5"
- fill="currentColor"
- fillOpacity={0.03}
- stroke="currentColor"
- strokeOpacity={0.06}
- />
- <rect
- x="46.5"
- y="11.5"
- width="4"
- height="1"
- rx="0.5"
- fill="currentColor"
- fillOpacity={0.05}
- />
- </svg>
- <h3 className="text-xs font-semibold text-foreground/60 mb-1">
- {t("notes.meeting.title")}
- </h3>
- <p className="text-xs text-foreground/50 dark:text-foreground/25 text-center max-w-52 mb-3">
- {t("notes.meeting.description")}
- </p>
- <span className="text-[8px] font-semibold uppercase tracking-widest text-primary/40 bg-primary/5 dark:bg-primary/8 px-2.5 py-1 rounded-md border border-primary/8 dark:border-primary/12">
- {t("notes.meeting.comingSoon")}
- </span>
- </div>
- ) : editorNote ? (
+ {editorNote ? (
<>
<NoteEditor
note={editorNote}
@@ -767,6 +694,11 @@ export default function PersonalNotesView({ onOpenSettings }: PersonalNotesViewP
}
: undefined
}
+ isMeetingTranscribing={isMeetingTranscribing}
+ meetingTranscript={meetingTranscript}
+ meetingPartialTranscript={meetingPartialTranscript}
+ meetingEvent={meetingRecordingRequest?.event}
+ onStopMeetingRecording={stopMeetingTranscription}
actionProcessingState={actionProcessingState}
actionName={actionName}
actionPicker={
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 244161bd0..4640a9508 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -2747,6 +2747,19 @@ class IPCHandlers {
}
});
+ ipcMain.handle("meeting-notification-respond", async (_event, detectionId, action) => {
+ try {
+ await this.meetingDetectionEngine.handleNotificationResponse(detectionId, action);
+ return { success: true };
+ } catch (error) {
+ return { success: false, error: error.message };
+ }
+ });
+
+ ipcMain.handle("get-meeting-notification-data", async () => {
+ return this.windowManager?._pendingNotificationData ?? null;
+ });
+
ipcMain.handle("get-desktop-sources", async (_event, types) => {
try {
const { desktopCapturer } = require("electron");
diff --git a/src/helpers/meetingDetectionEngine.js b/src/helpers/meetingDetectionEngine.js
index e75d88379..213e1dfbf 100644
--- a/src/helpers/meetingDetectionEngine.js
+++ b/src/helpers/meetingDetectionEngine.js
@@ -1,13 +1,21 @@
-const { Notification, BrowserWindow } = require("electron");
+const { BrowserWindow } = require("electron");
const debugLogger = require("./debugLogger");
const IMMINENT_THRESHOLD_MS = 5 * 60 * 1000;
class MeetingDetectionEngine {
- constructor(googleCalendarManager, meetingProcessDetector, audioActivityDetector) {
+ constructor(
+ googleCalendarManager,
+ meetingProcessDetector,
+ audioActivityDetector,
+ windowManager,
+ databaseManager
+ ) {
this.googleCalendarManager = googleCalendarManager;
this.meetingProcessDetector = meetingProcessDetector;
this.audioActivityDetector = audioActivityDetector;
+ this.windowManager = windowManager;
+ this.databaseManager = databaseManager;
this.activeDetections = new Map();
this.preferences = { processDetection: true, audioDetection: true };
this._bindListeners();
@@ -90,46 +98,39 @@ class MeetingDetectionEngine {
debugLogger.info("Showing notification", { detectionId, title }, "meeting");
- const notif = new Notification({ title, body });
-
- notif.on("click", () => {
- debugLogger.info("Notification clicked — starting recording", { detectionId }, "meeting");
-
- let event;
- if (imminentEvent) {
- event = imminentEvent;
- } else {
- event = {
- id: `detected-${Date.now()}`,
- calendar_id: "__detected__",
- summary: data.appName ? `${data.appName} Meeting` : "Detected Meeting",
- start_time: new Date().toISOString(),
- end_time: new Date(Date.now() + 3600000).toISOString(),
- is_all_day: 0,
- status: "confirmed",
- hangout_link: null,
- conference_data: null,
- organizer_email: null,
- attendees_count: 0,
- };
- }
+ let event;
+ if (imminentEvent) {
+ event = imminentEvent;
+ } else {
+ event = {
+ id: `detected-${Date.now()}`,
+ calendar_id: "__detected__",
+ summary: data.appName ? `${data.appName} Meeting` : "Detected Meeting",
+ start_time: new Date().toISOString(),
+ end_time: new Date(Date.now() + 3600000).toISOString(),
+ is_all_day: 0,
+ status: "confirmed",
+ hangout_link: null,
+ conference_data: null,
+ organizer_email: null,
+ attendees_count: 0,
+ };
+ }
- this.broadcastToWindows("meeting-detected-start-recording", {
- event,
- source,
- detectionId,
- });
- });
+ const detection = this.activeDetections.get(detectionId);
+ if (detection) {
+ detection.event = event;
+ }
- notif.on("close", () => {
- debugLogger.debug("Notification closed", { detectionId }, "meeting");
- this._dismiss(source, key);
- const detection = this.activeDetections.get(detectionId);
- if (detection) detection.dismissed = true;
+ this.windowManager.showMeetingNotification({
+ detectionId,
+ source,
+ key,
+ title,
+ body,
+ event,
});
- notif.show();
-
this.broadcastToWindows("meeting-detected", {
detectionId,
source,
@@ -149,6 +150,35 @@ class MeetingDetectionEngine {
}
}
+ async handleNotificationResponse(detectionId, action) {
+ debugLogger.info("Notification response", { detectionId, action }, "meeting");
+ const detection = this.activeDetections.get(detectionId);
+
+ if (action === "start" && detection) {
+ const eventSummary = detection.event?.summary || "Meeting";
+
+ const noteResult = this.databaseManager.saveNote(eventSummary, "", "meeting");
+ const meetingsFolder = this.databaseManager.getMeetingsFolder();
+
+ if (noteResult?.id && meetingsFolder?.id) {
+ await this.windowManager.createControlPanelWindow();
+ this.windowManager.snapControlPanelToMeetingMode();
+ this.windowManager.sendToControlPanel("navigate-to-meeting-note", {
+ noteId: noteResult.id,
+ folderId: meetingsFolder.id,
+ event: detection.event,
+ });
+ }
+ } else if (action === "dismiss") {
+ if (detection) {
+ this._dismiss(detection.source, detection.key);
+ detection.dismissed = true;
+ }
+ }
+
+ this.windowManager.dismissMeetingNotification();
+ }
+
_dismiss(source, key) {
if (source === "process") {
this.meetingProcessDetector.dismiss(key);
diff --git a/src/helpers/windowConfig.js b/src/helpers/windowConfig.js
index 4ce7867d2..51c9bc17e 100644
--- a/src/helpers/windowConfig.js
+++ b/src/helpers/windowConfig.js
@@ -72,6 +72,28 @@ const CONTROL_PANEL_CONFIG = {
type: "normal",
};
+const NOTIFICATION_WINDOW_CONFIG = {
+ width: 380,
+ height: 88,
+ frame: false,
+ transparent: true,
+ alwaysOnTop: true,
+ skipTaskbar: true,
+ resizable: false,
+ focusable: false,
+ hasShadow: false,
+ show: false,
+ webPreferences: {
+ preload: path.join(__dirname, "..", "..", "preload.js"),
+ nodeIntegration: false,
+ contextIsolation: true,
+ sandbox: true,
+ },
+ visibleOnAllWorkspaces: process.platform !== "win32",
+ type:
+ process.platform === "darwin" ? "panel" : process.platform === "linux" ? "toolbar" : "normal",
+};
+
class WindowPositionUtil {
static getMainWindowPosition(display, customSize = null) {
const { width, height } = customSize || WINDOW_SIZES.BASE;
@@ -82,6 +104,16 @@ class WindowPositionUtil {
return { x, y, width, height };
}
+ static getNotificationPosition(display) {
+ const width = 380;
+ const height = 88;
+ const MARGIN = 16;
+ const workArea = display.workArea || display.bounds;
+ const x = Math.max(0, workArea.x + workArea.width - width - MARGIN);
+ const y = Math.max(0, workArea.y + MARGIN);
+ return { x, y, width, height };
+ }
+
static setupAlwaysOnTop(window) {
if (process.platform === "darwin") {
// macOS: Use panel level for proper floating behavior
@@ -107,6 +139,7 @@ class WindowPositionUtil {
module.exports = {
MAIN_WINDOW_CONFIG,
CONTROL_PANEL_CONFIG,
+ NOTIFICATION_WINDOW_CONFIG,
WINDOW_SIZES,
WindowPositionUtil,
};
diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.js
index ff67f3f21..f160b2729 100644
--- a/src/helpers/windowManager.js
+++ b/src/helpers/windowManager.js
@@ -9,6 +9,7 @@ const { DEV_SERVER_PORT } = DevServerManager;
const {
MAIN_WINDOW_CONFIG,
CONTROL_PANEL_CONFIG,
+ NOTIFICATION_WINDOW_CONFIG,
WINDOW_SIZES,
WindowPositionUtil,
} = require("./windowConfig");
@@ -17,6 +18,8 @@ class WindowManager {
constructor() {
this.mainWindow = null;
this.controlPanelWindow = null;
+ this.notificationWindow = null;
+ this._notificationTimeout = null;
this.tray = null;
this.hotkeyManager = new HotkeyManager();
this.dragManager = new DragManager();
@@ -655,6 +658,98 @@ class WindowManager {
}
}
+ async showMeetingNotification(promptData) {
+ if (this.notificationWindow && !this.notificationWindow.isDestroyed()) {
+ this.notificationWindow.close();
+ this.notificationWindow = null;
+ }
+ if (this._notificationTimeout) {
+ clearTimeout(this._notificationTimeout);
+ this._notificationTimeout = null;
+ }
+
+ const display = screen.getPrimaryDisplay();
+ const position = WindowPositionUtil.getNotificationPosition(display);
+
+ this.notificationWindow = new BrowserWindow({
+ ...NOTIFICATION_WINDOW_CONFIG,
+ ...position,
+ });
+
+ WindowPositionUtil.setupAlwaysOnTop(this.notificationWindow);
+
+ if (process.env.NODE_ENV === "development") {
+ await DevServerManager.waitForDevServer();
+ await this.notificationWindow.loadURL(
+ `${DevServerManager.DEV_SERVER_URL}?meeting-notification=true`
+ );
+ } else {
+ const fileInfo = DevServerManager.getAppFilePath(false);
+ await this.notificationWindow.loadFile(fileInfo.path, {
+ query: { ...fileInfo.query, "meeting-notification": "true" },
+ });
+ }
+
+ this._pendingNotificationData = promptData;
+
+ setTimeout(() => {
+ if (this.notificationWindow && !this.notificationWindow.isDestroyed()) {
+ this.notificationWindow.webContents.send("meeting-notification-data", promptData);
+ this.notificationWindow.showInactive();
+ }
+ }, 300);
+
+ this._notificationTimeout = setTimeout(() => {
+ this.dismissMeetingNotification();
+ }, 30000);
+
+ this.notificationWindow.on("closed", () => {
+ this.notificationWindow = null;
+ if (this._notificationTimeout) {
+ clearTimeout(this._notificationTimeout);
+ this._notificationTimeout = null;
+ }
+ });
+ }
+
+ dismissMeetingNotification() {
+ if (this._notificationTimeout) {
+ clearTimeout(this._notificationTimeout);
+ this._notificationTimeout = null;
+ }
+ if (this.notificationWindow && !this.notificationWindow.isDestroyed()) {
+ this.notificationWindow.close();
+ }
+ this.notificationWindow = null;
+ }
+
+ sendToControlPanel(channel, data) {
+ const win = this.controlPanelWindow;
+ if (!win || win.isDestroyed()) return;
+ if (win.webContents.isLoading()) {
+ win.webContents.once("did-finish-load", () => {
+ if (!win.isDestroyed()) win.webContents.send(channel, data);
+ });
+ } else {
+ win.webContents.send(channel, data);
+ }
+ }
+
+ snapControlPanelToMeetingMode() {
+ const win = this.controlPanelWindow;
+ if (!win || win.isDestroyed()) return;
+ const display = screen.getPrimaryDisplay();
+ const workArea = display.workArea;
+ const width = Math.round(workArea.width / 3);
+ win.setBounds({
+ x: workArea.x + workArea.width - width,
+ y: workArea.y,
+ width,
+ height: workArea.height,
+ });
+ win.focus();
+ }
+
refreshLocalizedUi() {
MenuManager.setupMainMenu();
diff --git a/src/hooks/useFolderManagement.ts b/src/hooks/useFolderManagement.ts
index 90c4412f9..b9bdf2a3f 100644
--- a/src/hooks/useFolderManagement.ts
+++ b/src/hooks/useFolderManagement.ts
@@ -121,7 +121,10 @@ export function useFolderManagement(): UseFolderManagementReturn {
prevFolderIdRef.current = activeFolderId;
const loadForFolder = async () => {
const notes = await initializeNotes(null, 50, activeFolderId);
- setActiveNoteId(notes.length > 0 ? notes[0].id : null);
+ const presetNoteId = getActiveNoteIdValue();
+ if (!presetNoteId || !notes.some((n) => n.id === presetNoteId)) {
+ setActiveNoteId(notes.length > 0 ? notes[0].id : null);
+ }
};
loadForFolder();
}, [activeFolderId, isLoading]);
diff --git a/src/hooks/useMeetingRecording.ts b/src/hooks/useMeetingRecording.ts
deleted file mode 100644
index b412c37c4..000000000
--- a/src/hooks/useMeetingRecording.ts
+++ /dev/null
@@ -1,248 +0,0 @@
-import { useState, useEffect, useRef, useCallback } from "react";
-import logger from "../utils/logger";
-import type { CalendarEvent } from "../types/calendar";
-
-const SAFETY_TIMEOUT_BUFFER_MS = 30 * 60 * 1000;
-
-interface UseMeetingRecordingReturn {
- isRecording: boolean;
- isProcessing: boolean;
- activeMeeting: CalendarEvent | null;
- startRecording: (event: CalendarEvent) => Promise<void>;
- stopRecording: () => Promise<void>;
-}
-
-const getSystemAudioStream = async (): Promise<MediaStream | null> => {
- try {
- const sources = await window.electronAPI?.getDesktopSources(["screen"]);
- if (!sources?.length) return null;
-
- const stream = await navigator.mediaDevices.getUserMedia({
- audio: {
- mandatory: {
- chromeMediaSource: "desktop",
- chromeMediaSourceId: sources[0].id,
- },
- } as any,
- video: {
- mandatory: {
- chromeMediaSource: "desktop",
- chromeMediaSourceId: sources[0].id,
- minWidth: 1,
- maxWidth: 1,
- minHeight: 1,
- maxHeight: 1,
- },
- } as any,
- });
-
- stream.getVideoTracks().forEach((t) => t.stop());
- return new MediaStream(stream.getAudioTracks());
- } catch (err) {
- logger.error("Failed to capture system audio", { error: (err as Error).message }, "meeting");
- return null;
- }
-};
-
-export function useMeetingRecording(): UseMeetingRecordingReturn {
- const [isRecording, setIsRecording] = useState(false);
- const [isProcessing, setIsProcessing] = useState(false);
- const [activeMeeting, setActiveMeeting] = useState<CalendarEvent | null>(null);
-
- const mediaRecorderRef = useRef<MediaRecorder | null>(null);
- const audioChunksRef = useRef<Blob[]>([]);
- const recordingStartTimeRef = useRef<number | null>(null);
- const safetyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
- const activeMeetingRef = useRef<CalendarEvent | null>(null);
- const streamRef = useRef<MediaStream | null>(null);
-
- const cleanup = useCallback(() => {
- if (safetyTimeoutRef.current) {
- clearTimeout(safetyTimeoutRef.current);
- safetyTimeoutRef.current = null;
- }
- if (mediaRecorderRef.current?.state === "recording") {
- mediaRecorderRef.current.stop();
- }
- if (streamRef.current) {
- streamRef.current.getTracks().forEach((t) => t.stop());
- streamRef.current = null;
- }
- mediaRecorderRef.current = null;
- audioChunksRef.current = [];
- recordingStartTimeRef.current = null;
- }, []);
-
- const stopRecording = useCallback(async () => {
- if (!mediaRecorderRef.current || mediaRecorderRef.current.state !== "recording") return;
-
- if (safetyTimeoutRef.current) {
- clearTimeout(safetyTimeoutRef.current);
- safetyTimeoutRef.current = null;
- }
-
- return new Promise<void>((resolve) => {
- const recorder = mediaRecorderRef.current!;
- const event = activeMeetingRef.current;
- const mimeType = recorder.mimeType || "audio/webm";
-
- recorder.onstop = async () => {
- setIsRecording(false);
- setIsProcessing(true);
-
- const audioBlob = new Blob(audioChunksRef.current, { type: mimeType });
- const durationSeconds = recordingStartTimeRef.current
- ? (Date.now() - recordingStartTimeRef.current) / 1000
- : 0;
-
- if (streamRef.current) {
- streamRef.current.getTracks().forEach((t) => t.stop());
- streamRef.current = null;
- }
- mediaRecorderRef.current = null;
- audioChunksRef.current = [];
- recordingStartTimeRef.current = null;
-
- try {
- const arrayBuffer = await audioBlob.arrayBuffer();
- const result = await window.electronAPI?.cloudTranscribe(arrayBuffer, {
- useCase: "meeting" as any,
- diarization: true as any,
- });
-
- if (result?.success && result.text) {
- const title = event?.summary || "Meeting Recording";
- const noteResult = await window.electronAPI?.saveNote(
- title,
- "",
- "meeting",
- null,
- Math.round(durationSeconds),
- null
- );
-
- if (noteResult?.success && noteResult.note) {
- await window.electronAPI?.updateNote(noteResult.note.id, {
- transcript: result.text,
- calendar_event_id: event?.id ?? null,
- });
- logger.info(
- "Meeting transcription saved",
- { noteId: noteResult.note.id, eventId: event?.id },
- "meeting"
- );
- }
- } else {
- logger.error("Meeting transcription failed", { error: result?.error }, "meeting");
- }
- } catch (err) {
- logger.error(
- "Meeting recording processing failed",
- { error: (err as Error).message },
- "meeting"
- );
- } finally {
- setIsProcessing(false);
- setActiveMeeting(null);
- activeMeetingRef.current = null;
- resolve();
- }
- };
-
- recorder.stop();
- });
- }, []);
-
- const startRecording = useCallback(
- async (event: CalendarEvent) => {
- if (isRecording || isProcessing) return;
-
- const stream = await getSystemAudioStream();
- if (!stream) {
- logger.error("Could not capture system audio for meeting", {}, "meeting");
- return;
- }
-
- streamRef.current = stream;
- const recorder = new MediaRecorder(stream);
- mediaRecorderRef.current = recorder;
- audioChunksRef.current = [];
- recordingStartTimeRef.current = Date.now();
- activeMeetingRef.current = event;
-
- recorder.ondataavailable = (e) => {
- if (e.data.size > 0) audioChunksRef.current.push(e.data);
- };
-
- recorder.start();
- setIsRecording(true);
- setActiveMeeting(event);
-
- const eventDurationMs =
- new Date(event.end_time).getTime() - new Date(event.start_time).getTime();
- const safetyMs = Math.max(eventDurationMs, 0) + SAFETY_TIMEOUT_BUFFER_MS;
-
- safetyTimeoutRef.current = setTimeout(() => {
- logger.info("Safety timeout reached, auto-stopping meeting recording", {}, "meeting");
- stopRecording();
- }, safetyMs);
-
- logger.info(
- "Meeting recording started",
- { eventId: event.id, summary: event.summary },
- "meeting"
- );
- },
- [isRecording, isProcessing, stopRecording]
- );
-
- useEffect(() => {
- const cleanups: Array<() => void> = [];
-
- const meetingStartingCleanup = window.electronAPI?.onGcalMeetingStarting?.((data: any) => {
- logger.info("Meeting starting notification", { eventId: data?.event?.id }, "meeting");
- });
- if (meetingStartingCleanup) cleanups.push(meetingStartingCleanup);
-
- const meetingEndedCleanup = window.electronAPI?.onGcalMeetingEnded?.((data: any) => {
- if (activeMeetingRef.current && data?.event?.id === activeMeetingRef.current.id) {
- logger.info(
- "Meeting ended, auto-stopping recording",
- { eventId: data.event.id },
- "meeting"
- );
- stopRecording();
- }
- });
- if (meetingEndedCleanup) cleanups.push(meetingEndedCleanup);
-
- const startRecordingCleanup = window.electronAPI?.onGcalStartRecording?.((data: any) => {
- if (data?.event && !activeMeetingRef.current) {
- startRecording(data.event);
- }
- });
- if (startRecordingCleanup) cleanups.push(startRecordingCleanup);
-
- const detectedStartCleanup = window.electronAPI?.onMeetingDetectedStartRecording?.(
- (data: any) => {
- if (data?.event && !activeMeetingRef.current) {
- startRecording(data.event);
- }
- }
- );
- if (detectedStartCleanup) cleanups.push(detectedStartCleanup);
-
- return () => {
- cleanups.forEach((fn) => fn());
- cleanup();
- };
- }, [startRecording, stopRecording, cleanup]);
-
- return {
- isRecording,
- isProcessing,
- activeMeeting,
- startRecording,
- stopRecording,
- };
-}
diff --git a/src/hooks/useMeetingTranscription.ts b/src/hooks/useMeetingTranscription.ts
new file mode 100644
index 000000000..184b8986b
--- /dev/null
+++ b/src/hooks/useMeetingTranscription.ts
@@ -0,0 +1,230 @@
+import { useState, useEffect, useRef, useCallback } from "react";
+import logger from "../utils/logger";
+
+interface UseMeetingTranscriptionReturn {
+ isTranscribing: boolean;
+ transcript: string;
+ partialTranscript: string;
+ startTranscription: () => Promise<void>;
+ stopTranscription: () => Promise<void>;
+}
+
+const WORKLET_CODE = `
+const BUFFER_SIZE = 800;
+class PCMStreamingProcessor extends AudioWorkletProcessor {
+ constructor() {
+ super();
+ this._buffer = new Int16Array(BUFFER_SIZE);
+ this._offset = 0;
+ this._stopped = false;
+ this.port.onmessage = (event) => {
+ if (event.data === "stop") {
+ if (this._offset > 0) {
+ const partial = this._buffer.slice(0, this._offset);
+ this.port.postMessage(partial.buffer, [partial.buffer]);
+ this._buffer = new Int16Array(BUFFER_SIZE);
+ this._offset = 0;
+ }
+ this._stopped = true;
+ }
+ };
+ }
+ process(inputs) {
+ if (this._stopped) return false;
+ const input = inputs[0]?.[0];
+ if (!input) return true;
+ for (let i = 0; i < input.length; i++) {
+ const s = Math.max(-1, Math.min(1, input[i]));
+ this._buffer[this._offset++] = s < 0 ? s * 0x8000 : s * 0x7fff;
+ if (this._offset >= BUFFER_SIZE) {
+ this.port.postMessage(this._buffer.buffer, [this._buffer.buffer]);
+ this._buffer = new Int16Array(BUFFER_SIZE);
+ this._offset = 0;
+ }
+ }
+ return true;
+ }
+}
+registerProcessor("pcm-meeting-processor", PCMStreamingProcessor);
+`;
+
+const getSystemAudioStream = async (): Promise<MediaStream | null> => {
+ try {
+ const sources = await window.electronAPI?.getDesktopSources(["screen"]);
+ if (!sources?.length) return null;
+
+ const stream = await navigator.mediaDevices.getUserMedia({
+ audio: {
+ mandatory: {
+ chromeMediaSource: "desktop",
+ chromeMediaSourceId: sources[0].id,
+ },
+ } as any,
+ video: {
+ mandatory: {
+ chromeMediaSource: "desktop",
+ chromeMediaSourceId: sources[0].id,
+ minWidth: 1,
+ maxWidth: 1,
+ minHeight: 1,
+ maxHeight: 1,
+ },
+ } as any,
+ });
+
+ stream.getVideoTracks().forEach((t) => t.stop());
+ return new MediaStream(stream.getAudioTracks());
+ } catch (err) {
+ logger.error("Failed to capture system audio", { error: (err as Error).message }, "meeting");
+ return null;
+ }
+};
+
+export function useMeetingTranscription(): UseMeetingTranscriptionReturn {
+ const [isTranscribing, setIsTranscribing] = useState(false);
+ const [transcript, setTranscript] = useState("");
+ const [partialTranscript, setPartialTranscript] = useState("");
+
+ const audioContextRef = useRef<AudioContext | null>(null);
+ const sourceRef = useRef<MediaStreamAudioSourceNode | null>(null);
+ const processorRef = useRef<AudioWorkletNode | null>(null);
+ const streamRef = useRef<MediaStream | null>(null);
+ const ipcCleanupsRef = useRef<Array<() => void>>([]);
+ const isTranscribingRef = useRef(false);
+ const workletBlobUrlRef = useRef<string | null>(null);
+
+ const cleanup = useCallback(async () => {
+ ipcCleanupsRef.current.forEach((fn) => fn());
+ ipcCleanupsRef.current = [];
+
+ if (processorRef.current) {
+ processorRef.current.port.postMessage("stop");
+ processorRef.current.disconnect();
+ processorRef.current = null;
+ }
+
+ if (sourceRef.current) {
+ sourceRef.current.disconnect();
+ sourceRef.current = null;
+ }
+
+ if (streamRef.current) {
+ try {
+ streamRef.current.getTracks().forEach((t) => t.stop());
+ } catch {}
+ streamRef.current = null;
+ }
+
+ if (audioContextRef.current) {
+ try {
+ await audioContextRef.current.close();
+ } catch {}
+ audioContextRef.current = null;
+ }
+
+ if (workletBlobUrlRef.current) {
+ URL.revokeObjectURL(workletBlobUrlRef.current);
+ workletBlobUrlRef.current = null;
+ }
+
+ await window.electronAPI?.deepgramStreamingStop?.();
+ }, []);
+
+ const stopTranscription = useCallback(async () => {
+ if (!isTranscribingRef.current) return;
+ isTranscribingRef.current = false;
+ setIsTranscribing(false);
+ await cleanup();
+ logger.info("Meeting transcription stopped", {}, "meeting");
+ }, [cleanup]);
+
+ const startTranscription = useCallback(async () => {
+ if (isTranscribingRef.current) return;
+
+ const stream = await getSystemAudioStream();
+ if (!stream) {
+ logger.error("Could not capture system audio for meeting transcription", {}, "meeting");
+ return;
+ }
+ streamRef.current = stream;
+
+ try {
+ await window.electronAPI?.deepgramStreamingWarmup?.();
+
+ const audioContext = new AudioContext({ sampleRate: 16000 });
+ audioContextRef.current = audioContext;
+
+ const blobUrl = URL.createObjectURL(
+ new Blob([WORKLET_CODE], { type: "application/javascript" })
+ );
+ workletBlobUrlRef.current = blobUrl;
+ await audioContext.audioWorklet.addModule(blobUrl);
+
+ const source = audioContext.createMediaStreamSource(stream);
+ sourceRef.current = source;
+
+ const processor = new AudioWorkletNode(audioContext, "pcm-meeting-processor");
+ processorRef.current = processor;
+
+ processor.port.onmessage = (event) => {
+ if (!isTranscribingRef.current) return;
+ window.electronAPI?.deepgramStreamingSend?.(event.data);
+ };
+
+ source.connect(processor);
+
+ const partialCleanup = window.electronAPI?.onDeepgramPartialTranscript?.((text) => {
+ setPartialTranscript(text);
+ });
+ if (partialCleanup) ipcCleanupsRef.current.push(partialCleanup);
+
+ const finalCleanup = window.electronAPI?.onDeepgramFinalTranscript?.((text) => {
+ setTranscript(text);
+ setPartialTranscript("");
+ });
+ if (finalCleanup) ipcCleanupsRef.current.push(finalCleanup);
+
+ const result = await window.electronAPI?.deepgramStreamingStart?.({
+ sampleRate: 16000,
+ });
+
+ if (!result?.success) {
+ logger.error(
+ "Failed to start Deepgram streaming",
+ { error: result?.error, code: result?.code },
+ "meeting"
+ );
+ await cleanup();
+ return;
+ }
+
+ isTranscribingRef.current = true;
+ setIsTranscribing(true);
+ logger.info("Meeting transcription started", {}, "meeting");
+ } catch (err) {
+ logger.error(
+ "Meeting transcription setup failed",
+ { error: (err as Error).message },
+ "meeting"
+ );
+ await cleanup();
+ }
+ }, [cleanup]);
+
+ useEffect(() => {
+ return () => {
+ if (isTranscribingRef.current) {
+ isTranscribingRef.current = false;
+ cleanup();
+ }
+ };
+ }, [cleanup]);
+
+ return {
+ isTranscribing,
+ transcript,
+ partialTranscript,
+ startTranscription,
+ stopTranscription,
+ };
+}
diff --git a/src/index.css b/src/index.css
index d99400912..8b795aa72 100644
--- a/src/index.css
+++ b/src/index.css
@@ -167,11 +167,13 @@
}
/* Make dictation window (App) transparent, but keep control panel solid */
- body:has(.dictation-window) {
+ body:has(.dictation-window),
+ body:has(.meeting-notification-window) {
background: transparent;
}
- body:has(.dictation-window) #root {
+ body:has(.dictation-window) #root,
+ body:has(.meeting-notification-window) #root {
background: transparent;
}
}
diff --git a/src/main.jsx b/src/main.jsx
index 1ab95172e..9c06e1fb7 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -17,6 +17,9 @@ const controlPanelImport = () => import("./components/ControlPanel.tsx");
const onboardingFlowImport = () => import("./components/OnboardingFlow.tsx");
const ControlPanel = React.lazy(controlPanelImport);
const OnboardingFlow = React.lazy(onboardingFlowImport);
+const MeetingNotificationOverlay = React.lazy(
+ () => import("./components/MeetingNotificationOverlay.tsx")
+);
let root = null;
@@ -270,6 +273,20 @@ if (!isOAuthBrowserRedirect()) {
function AppRouter() {
useTheme();
+ const isMeetingNotification = window.location.search.includes("meeting-notification=true");
+
+ if (isMeetingNotification) {
+ return (
+ <Suspense fallback={<div />}>
+ <MeetingNotificationOverlay />
+ </Suspense>
+ );
+ }
+
+ return <MainApp />;
+}
+
+function MainApp() {
const { isSignedIn, isLoaded: authLoaded } = useAuth();
const [showOnboarding, setShowOnboarding] = useState(false);
diff --git a/src/types/electron.ts b/src/types/electron.ts
index fd1a44a97..adcdad10a 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -910,6 +910,15 @@ declare global {
) => Promise<{ success: boolean }>;
onMeetingDetected?: (callback: (data: any) => void) => () => void;
onMeetingDetectedStartRecording?: (callback: (data: any) => void) => () => void;
+ onMeetingNotificationData?: (callback: (data: any) => void) => () => void;
+ getMeetingNotificationData?: () => Promise<any>;
+ meetingNotificationRespond?: (
+ detectionId: string,
+ action: string
+ ) => Promise<{ success: boolean }>;
+ onNavigateToMeetingNote?: (
+ callback: (data: { noteId: number; folderId: number; event: any }) => void
+ ) => () => void;
};
api?: {