Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"extraResources": [
".env",
"src/assets/**/*",
"resources/bin/macos-audio-tap",
"resources/bin/macos-globe-listener",
"resources/bin/macos-fast-paste",
"resources/bin/macos-mic-listener",
Expand Down
39 changes: 7 additions & 32 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ if (process.platform === "linux" && process.env.XDG_SESSION_TYPE === "wayland")
app.commandLine.appendSwitch("enable-features", "UseOzonePlatform,WaylandWindowDecorations");
}

// Enable system audio loopback capture on macOS via CoreAudio Taps (Electron 39+).
// Without these flags, getDisplayMedia({ audio: "loopback" }) returns a live audio track
// that produces only silence (all-zero samples).
if (process.platform === "darwin") {
app.commandLine.appendSwitch(
"enable-features",
"MacLoopbackAudioForScreenShare,MacSckSystemAudioLoopbackOverride,MacCatapSystemAudioLoopbackCapture"
);
}

// Set desktop filename so Wayland compositors can match windows to the .desktop entry.
// This allows XDG portals (e.g. PipeWire) to persist permissions across sessions.
if (process.platform === "linux") {
Expand Down Expand Up @@ -197,6 +187,7 @@ const WhisperCudaManager = require("./src/helpers/whisperCudaManager");
const GoogleCalendarManager = require("./src/helpers/googleCalendarManager");
const MeetingProcessDetector = require("./src/helpers/meetingProcessDetector");
const AudioActivityDetector = require("./src/helpers/audioActivityDetector");
const AudioTapManager = require("./src/helpers/audioTapManager");
const MeetingDetectionEngine = require("./src/helpers/meetingDetectionEngine");
const { i18nMain, changeLanguage } = require("./src/helpers/i18nMain");
const { ensureYdotool } = require("./src/helpers/ensureYdotool");
Expand All @@ -218,6 +209,7 @@ let textEditMonitor = null;
let whisperCudaManager = null;
let googleCalendarManager = null;
let meetingDetectionEngine = null;
let audioTapManager = null;
let ipcHandlers = null;
let globeKeyAlertShown = false;
let authBridgeServer = null;
Expand Down Expand Up @@ -294,6 +286,7 @@ function initializeCoreManagers() {
updateManager.setWindowManager(windowManager);
windowsKeyManager = new WindowsKeyManager();
textEditMonitor = new TextEditMonitor();
audioTapManager = new AudioTapManager();
windowManager.textEditMonitor = textEditMonitor;

// IPC handlers must be registered before window content loads
Expand All @@ -310,6 +303,7 @@ function initializeCoreManagers() {
whisperCudaManager,
googleCalendarManager,
meetingDetectionEngine,
audioTapManager,
getTrayManager: () => trayManager,
});
}
Expand Down Expand Up @@ -534,28 +528,6 @@ async function startApp() {
}
);

// Handle getDisplayMedia() calls from the renderer — auto-select the first
// screen source with loopback audio so no system picker dialog is shown.
const { desktopCapturer } = require("electron");
session.defaultSession.setDisplayMediaRequestHandler(async (_request, callback) => {
try {
const sources = await desktopCapturer.getSources({ types: ["screen"] });
debugLogger.debug("Display media sources", {
count: sources.length,
names: sources.map((s) => s.name),
});
if (!sources.length) {
debugLogger.error("No screen sources available — System Audio permission may be denied");
callback({});
return;
}
callback({ video: sources[0], audio: "loopback" });
} catch (err) {
debugLogger.error("Display media handler error", { error: err.message });
callback({});
}
});

windowManager.setActivationModeCache(environmentManager.getActivationMode());
windowManager.setFloatingIconAutoHide(environmentManager.getFloatingIconAutoHide());
windowManager.setPanelStartPosition(environmentManager.getPanelStartPosition());
Expand Down Expand Up @@ -1150,6 +1122,9 @@ if (gotSingleInstanceLock) {
if (googleCalendarManager) {
googleCalendarManager.stop();
}
if (audioTapManager) {
audioTapManager.stop().catch(() => {});
}
if (ipcHandlers) {
ipcHandlers._cleanupTextEditMonitor();
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"compile:linux-paste": "node scripts/build-linux-fast-paste.js",
"compile:media-remote": "node scripts/build-media-remote.js",
"compile:mic-listener": "node scripts/build-macos-mic-listener.js",
"compile:native": "npm run compile:globe && npm run compile:fast-paste && npm run compile:winkeys && npm run compile:winpaste && npm run compile:linux-paste && npm run compile:text-monitor && npm run compile:media-remote && npm run compile:mic-listener",
"compile:audio-tap": "node scripts/build-macos-audio-tap.js",
"compile:native": "npm run compile:globe && npm run compile:fast-paste && npm run compile:winkeys && npm run compile:winpaste && npm run compile:linux-paste && npm run compile:text-monitor && npm run compile:media-remote && npm run compile:mic-listener && npm run compile:audio-tap",
"prestart": "npm run compile:native",
"start": "electron .",
"predev": "npm run compile:native",
Expand Down
8 changes: 3 additions & 5 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
// Clipboard functions
checkAccessibilityPermission: (silent) =>
ipcRenderer.invoke("check-accessibility-permission", silent),
promptAccessibilityPermission: () =>
ipcRenderer.invoke("prompt-accessibility-permission"),
promptAccessibilityPermission: () => ipcRenderer.invoke("prompt-accessibility-permission"),
readClipboard: () => ipcRenderer.invoke("read-clipboard"),
writeClipboard: (text) => ipcRenderer.invoke("write-clipboard", text),
checkPasteTools: () => ipcRenderer.invoke("check-paste-tools"),
Expand Down Expand Up @@ -362,7 +361,9 @@ contextBridge.exposeInMainWorld("electronAPI", {

// System settings helpers for microphone/audio permissions
requestMicrophoneAccess: () => ipcRenderer.invoke("request-microphone-access"),
checkMicrophoneAccess: () => ipcRenderer.invoke("check-microphone-access"),
checkSystemAudioAccess: () => ipcRenderer.invoke("check-system-audio-access"),
requestSystemAudioAccess: () => ipcRenderer.invoke("request-system-audio-access"),
openMicrophoneSettings: () => ipcRenderer.invoke("open-microphone-settings"),
openSoundInputSettings: () => ipcRenderer.invoke("open-sound-input-settings"),
openAccessibilitySettings: () => ipcRenderer.invoke("open-accessibility-settings"),
Expand Down Expand Up @@ -607,9 +608,6 @@ contextBridge.exposeInMainWorld("electronAPI", {
gcalGetUpcomingEvents: (windowMinutes) =>
ipcRenderer.invoke("gcal-get-upcoming-events", windowMinutes),

// Desktop audio capture
getDesktopSources: (types) => ipcRenderer.invoke("get-desktop-sources", types),

// Google Calendar event listeners
onGcalMeetingStarting: registerListener(
"gcal-meeting-starting",
Expand Down
Loading
Loading