Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat(gcal): add primary-only toggle to skip shared calendars (#816)
Gabriel Stein15eb1d85f8e3
diff --git a/preload.js b/preload.jsindex f4b8714d5..b1cb5483b 100644--- a/preload.js+++ b/preload.js@@ -809,6 +809,7 @@ contextBridge.exposeInMainWorld("electronAPI", {gcalGetCalendars: () => ipcRenderer.invoke("gcal-get-calendars"),gcalSetCalendarSelection: (calendarId, isSelected) =>ipcRenderer.invoke("gcal-set-calendar-selection", calendarId, isSelected),+ gcalSetPrimaryOnly: (value) => ipcRenderer.invoke("gcal-set-primary-only", value),gcalSyncEvents: () => ipcRenderer.invoke("gcal-sync-events"),gcalGetUpcomingEvents: (windowMinutes) =>ipcRenderer.invoke("gcal-get-upcoming-events", windowMinutes),diff --git a/src/components/IntegrationsView.tsx b/src/components/IntegrationsView.tsxindex 6e63aed1e..6170bd7e1 100644--- a/src/components/IntegrationsView.tsx+++ b/src/components/IntegrationsView.tsx@@ -3,7 +3,8 @@ import { useTranslation } from "react-i18next";import { Code2, Info, Loader2, Mail, Plus, Unlink } from "lucide-react";import { Button } from "./ui/button";import { Badge } from "./ui/badge";-import { SettingsPanel, SettingsPanelRow } from "./ui/SettingsSection";+import { SettingsPanel, SettingsPanelRow, SettingsRow } from "./ui/SettingsSection";+import { Toggle } from "./ui/toggle";import {ConfirmDialog,Dialog,@@ -37,7 +38,7 @@ function SectionLabel({ children }: { children: React.ReactNode }) {export default function IntegrationsView({ isPaid, onUpgrade }: IntegrationsViewProps) {const { t } = useTranslation();- const { gcalAccounts, setGcalAccounts } = useSettingsStore();+ const { gcalAccounts, setGcalAccounts, gcalPrimaryOnly, setGcalPrimaryOnly } = useSettingsStore();const [isConnecting, setIsConnecting] = useState(false);const [disconnectingEmail, setDisconnectingEmail] = useState<string | null>(null);const [confirmDisconnectEmail, setConfirmDisconnectEmail] = useState<string | null>(null);@@ -184,6 +185,17 @@ export default function IntegrationsView({ isPaid, onUpgrade }: IntegrationsView</SettingsPanelRow>))}+ {hasAccounts && (+ <SettingsPanelRow>+ <SettingsRow+ label={t("integrations.googleCalendar.primaryOnly")}+ description={t("integrations.googleCalendar.primaryOnlyDescription")}+ >+ <Toggle checked={gcalPrimaryOnly} onChange={setGcalPrimaryOnly} />+ </SettingsRow>+ </SettingsPanelRow>+ )}+{hasAccounts && (<SettingsPanelRow><buttondiff --git a/src/helpers/database.js b/src/helpers/database.jsindex 46997ed12..d2e7491c5 100644--- a/src/helpers/database.js+++ b/src/helpers/database.js@@ -342,6 +342,14 @@ class DatabaseManager {if (!err.message.includes("duplicate column")) throw err;}+ try {+ this.db.exec(+ "ALTER TABLE google_calendars ADD COLUMN is_primary INTEGER NOT NULL DEFAULT 0"+ );+ } catch (err) {+ if (!err.message.includes("duplicate column")) throw err;+ }+this.db.exec(`CREATE TABLE IF NOT EXISTS calendar_events (id TEXT PRIMARY KEY,@@ -1324,13 +1332,14 @@ class DatabaseManager {try {if (!this.db) throw new Error("Database not initialized");const stmt = this.db.prepare(- `INSERT INTO google_calendars (id, summary, description, background_color, account_email)- VALUES (?, ?, ?, ?, ?)+ `INSERT INTO google_calendars (id, summary, description, background_color, account_email, is_primary)+ VALUES (?, ?, ?, ?, ?, ?)ON CONFLICT(id) DO UPDATE SETsummary = excluded.summary,description = excluded.description,background_color = excluded.background_color,- account_email = excluded.account_email`+ account_email = excluded.account_email,+ is_primary = excluded.is_primary`);for (const cal of calendars) {stmt.run(@@ -1338,7 +1347,8 @@ class DatabaseManager {cal.summary,cal.description || null,cal.background_color || null,- accountEmail+ accountEmail,+ cal.is_primary ? 1 : 0);}return { success: true };@@ -1348,6 +1358,21 @@ class DatabaseManager {}}+ applyPrimaryOnlyToSelection(primaryOnly) {+ try {+ if (!this.db) throw new Error("Database not initialized");+ this.db+ .prepare(+ "UPDATE google_calendars SET is_selected = CASE WHEN ? = 1 THEN is_primary ELSE 1 END"+ )+ .run(primaryOnly ? 1 : 0);+ return { success: true };+ } catch (error) {+ debugLogger.error("Error applying primary-only selection", { error: error.message }, "gcal");+ throw error;+ }+ }+getGoogleCalendars(accountEmail = null) {try {if (!this.db) throw new Error("Database not initialized");@@ -1592,6 +1617,25 @@ class DatabaseManager {}}+ removeEventsFromDeselectedCalendars() {+ try {+ if (!this.db) throw new Error("Database not initialized");+ this.db+ .prepare(+ "DELETE FROM calendar_events WHERE calendar_id NOT IN (SELECT id FROM google_calendars WHERE is_selected = 1)"+ )+ .run();+ return { success: true };+ } catch (error) {+ debugLogger.error(+ "Error removing events from deselected calendars",+ { error: error.message },+ "gcal"+ );+ throw error;+ }+ }+getMeetingsFolder() {try {if (!this.db) throw new Error("Database not initialized");diff --git a/src/helpers/googleCalendarManager.js b/src/helpers/googleCalendarManager.jsindex 872233f12..c5cc35687 100644--- a/src/helpers/googleCalendarManager.js+++ b/src/helpers/googleCalendarManager.js@@ -18,13 +18,15 @@ class GoogleCalendarManager {this.SYNC_INTERVAL_MS = 2 * 60 * 1000;this._consecutiveFailures = 0;this._lastFocusSync = 0;+ this.primaryOnly = true;}start() {this._loadAccounts();if (this.accounts.size === 0) return;- this.syncEvents()+ this.fetchCalendars()+ .then(() => this.syncEvents()).then(() => {this.scheduleNextMeeting();this._consecutiveFailures = 0;@@ -133,6 +135,7 @@ class GoogleCalendarManager {summary: item.summary,description: item.description || null,background_color: item.backgroundColor || null,+ is_primary: item.primary === true,}));this.databaseManager.saveGoogleCalendars(calendars, email);allCalendars.push(...calendars);@@ -141,6 +144,8 @@ class GoogleCalendarManager {}}+ this.databaseManager.applyPrimaryOnlyToSelection(this.primaryOnly);+ this.databaseManager.removeEventsFromDeselectedCalendars();return allCalendars;}@@ -378,6 +383,18 @@ class GoogleCalendarManager {this.scheduleNextMeeting();}+ async setPrimaryOnly(value) {+ if (this.primaryOnly === value) return;+ this.primaryOnly = value;+ if (!this.isConnected()) return;++ await this.fetchCalendars();+ this.notifiedMeetings.clear();+ await this.syncEvents();+ this.scheduleNextMeeting();+ this.broadcastToWindows("gcal-events-synced", {});+ }+async getUpcomingEvents(windowMinutes) {return this.databaseManager.getUpcomingEvents(windowMinutes);}diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 1a54bb21b..0144fc136 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -7128,6 +7128,15 @@ class IPCHandlers {}});+ ipcMain.handle("gcal-set-primary-only", async (_event, value) => {+ try {+ await this.googleCalendarManager.setPrimaryOnly(value);+ return { success: true };+ } catch (error) {+ return { success: false, error: error.message };+ }+ });+ipcMain.handle("gcal-sync-events", async () => {try {await this.googleCalendarManager.syncEvents();diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex b2fa217f1..c6a7a44fd 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -2360,6 +2360,8 @@"connecting": "Verbinde...","connected": "Verbunden","addAnother": "Weiteren Kalender hinzufügen",+ "primaryOnly": "Nur Hauptkalender synchronisieren",+ "primaryOnlyDescription": "Termine aus mit dir geteilten Kalendern ignorieren.","disconnect": "Trennen","disconnectConfirm": "{{email}} trennen?","disconnectDescription": "Besprechungsnotizen werden von diesem Kalender nicht mehr aufgezeichnet.",diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex bf782434e..d932b3ce8 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -2504,6 +2504,8 @@"connecting": "Connecting...","connected": "Connected","addAnother": "Add another calendar",+ "primaryOnly": "Sync primary calendar only",+ "primaryOnlyDescription": "Ignore events from calendars shared with you.","disconnect": "Disconnect","disconnectConfirm": "Disconnect {{email}}?","disconnectDescription": "Meeting notes will no longer be recorded from this calendar.",diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex 1ffe2d1f4..345bfc894 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -2408,6 +2408,8 @@"connecting": "Conectando...","connected": "Conectado","addAnother": "Añadir otro calendario",+ "primaryOnly": "Sincronizar solo el calendario principal",+ "primaryOnlyDescription": "Ignorar los eventos de los calendarios compartidos contigo.","disconnect": "Desconectar","disconnectConfirm": "¿Desconectar {{email}}?","disconnectDescription": "Ya no se grabarán notas de reuniones de este calendario.",diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex c8b47be61..fcdc41cd5 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -2408,6 +2408,8 @@"connecting": "Connexion...","connected": "Connecté","addAnother": "Ajouter un autre calendrier",+ "primaryOnly": "Synchroniser uniquement le calendrier principal",+ "primaryOnlyDescription": "Ignorer les événements des calendriers partagés avec vous.","disconnect": "Déconnecter","disconnectConfirm": "Déconnecter {{email}} ?","disconnectDescription": "Les notes de réunion ne seront plus enregistrées depuis ce calendrier.",diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex 1ca0887eb..b022947bd 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -2360,6 +2360,8 @@"connecting": "Connessione...","connected": "Connesso","addAnother": "Aggiungi un altro calendario",+ "primaryOnly": "Sincronizza solo il calendario principale",+ "primaryOnlyDescription": "Ignora gli eventi dei calendari condivisi con te.","disconnect": "Disconnetti","disconnectConfirm": "Disconnettere {{email}}?","disconnectDescription": "Le note delle riunioni non saranno più registrate da questo calendario.",diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 2d232d06d..1c6b7be7c 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -2360,6 +2360,8 @@"connecting": "接続中...","connected": "接続済み","addAnother": "別のカレンダーを追加",+ "primaryOnly": "メインカレンダーのみ同期",+ "primaryOnlyDescription": "共有されたカレンダーの予定は無視します。","disconnect": "切断","disconnectConfirm": "{{email}} を切断しますか?","disconnectDescription": "このカレンダーからの会議メモは記録されなくなります。",diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex c08a48f6b..cf4ee2fc3 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -2360,6 +2360,8 @@"connecting": "Conectando...","connected": "Conectado","addAnother": "Adicionar outro calendário",+ "primaryOnly": "Sincronizar apenas o calendário principal",+ "primaryOnlyDescription": "Ignorar eventos de calendários compartilhados com você.","disconnect": "Desconectar","disconnectConfirm": "Desconectar {{email}}?","disconnectDescription": "As notas de reunião não serão mais gravadas deste calendário.",diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex bf538363f..fb80337c3 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -2362,6 +2362,8 @@"connecting": "Подключение...","connected": "Подключено","addAnother": "Добавить ещё один календарь",+ "primaryOnly": "Синхронизировать только основной календарь",+ "primaryOnlyDescription": "Игнорировать события из календарей, к которым вам открыли доступ.","disconnect": "Отключить","disconnectConfirm": "Отключить {{email}}?","disconnectDescription": "Заметки встреч больше не будут записываться из этого календаря.",diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex ca689eab1..a17d0a96f 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -2360,6 +2360,8 @@"connecting": "连接中...","connected": "已连接","addAnother": "添加其他日历",+ "primaryOnly": "仅同步主日历",+ "primaryOnlyDescription": "忽略他人共享给你的日历事件。","disconnect": "断开","disconnectConfirm": "断开 {{email}}?","disconnectDescription": "将不再从此日历记录会议笔记。",diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex abb18555e..8f30c7a23 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -2360,6 +2360,8 @@"connecting": "連接中...","connected": "已連接","addAnother": "新增其他日曆",+ "primaryOnly": "僅同步主要日曆",+ "primaryOnlyDescription": "忽略他人分享給你的日曆事件。","disconnect": "中斷連接","disconnectConfirm": "中斷 {{email}} 的連接?","disconnectDescription": "將不再從此日曆記錄會議筆記。",diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.tsindex b6c9a2ac7..6e7d0076e 100644--- a/src/stores/settingsStore.ts+++ b/src/stores/settingsStore.ts@@ -132,6 +132,7 @@ const BOOLEAN_SETTINGS = new Set(["dictationAgentDisableThinking","noteFormattingDisableThinking","chatAgentDisableThinking",+ "gcalPrimaryOnly",]);const ARRAY_SETTINGS = new Set(["customDictionary", "gcalAccounts"]);@@ -355,6 +356,7 @@ export interface SettingsStategcalAccounts: GoogleCalendarAccount[];gcalConnected: boolean;gcalEmail: string;+ gcalPrimaryOnly: boolean;meetingProcessDetection: boolean;meetingAudioDetection: boolean;speakerDiarizationEnabled: boolean;@@ -534,6 +536,7 @@ export interface SettingsStatesetFloatingIconAutoHide: (enabled: boolean) => void;setStartMinimized: (enabled: boolean) => void;setGcalAccounts: (accounts: GoogleCalendarAccount[]) => void;+ setGcalPrimaryOnly: (value: boolean) => void;setMeetingProcessDetection: (value: boolean) => void;setMeetingAudioDetection: (value: boolean) => void;setSpeakerDiarizationEnabled: (value: boolean) => void;@@ -772,6 +775,7 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({gcalEmail: accounts[0]?.email ?? "",};})(),+ gcalPrimaryOnly: readBoolean("gcalPrimaryOnly", true),meetingProcessDetection: readBoolean("meetingProcessDetection", true),meetingAudioDetection: readBoolean("meetingAudioDetection", true),speakerDiarizationEnabled: readBoolean("speakerDiarizationEnabled", true),@@ -1221,6 +1225,11 @@ export const useSettingsStore = create<SettingsState>()((set, get) => ({gcalEmail: accounts[0]?.email ?? "",});},+ setGcalPrimaryOnly: (value: boolean) => {+ if (isBrowser) localStorage.setItem("gcalPrimaryOnly", String(value));+ useSettingsStore.setState({ gcalPrimaryOnly: value });+ if (isBrowser) window.electronAPI?.gcalSetPrimaryOnly?.(value);+ },setMeetingProcessDetection: createBooleanSetter("meetingProcessDetection"),setMeetingAudioDetection: createBooleanSetter("meetingAudioDetection"),setSpeakerDiarizationEnabled: (value: boolean) => {@@ -1778,6 +1787,17 @@ export async function initializeSettings(): Promise<void> {);}+ try {+ const currentState = useSettingsStore.getState();+ await window.electronAPI.gcalSetPrimaryOnly?.(currentState.gcalPrimaryOnly);+ } catch (err) {+ logger.warn(+ "Failed to sync gcal primary-only on startup",+ { error: (err as Error).message },+ "settings"+ );+ }+try {const currentState = useSettingsStore.getState();await window.electronAPI.setSpeakerDiarizationEnabled?.(diff --git a/src/types/calendar.ts b/src/types/calendar.tsindex 51c0e7c7d..86cc612d3 100644--- a/src/types/calendar.ts+++ b/src/types/calendar.ts@@ -4,6 +4,7 @@ export interface GoogleCalendar {description: string | null;background_color: string | null;is_selected: number;+ is_primary: number;sync_token: string | null;}diff --git a/src/types/electron.ts b/src/types/electron.tsindex ff6c6495f..d85429fd0 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -1507,6 +1507,7 @@ declare global {calendarId: string,isSelected: boolean) => Promise<{ success: boolean; error?: string }>;+ gcalSetPrimaryOnly?: (value: boolean) => Promise<{ success: boolean; error?: string }>;gcalSyncEvents?: () => Promise<{ success: boolean; error?: string }>;gcalGetUpcomingEvents?: (windowMinutes?: number