Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbf82f9317 | ||
|
|
bf9ec15912 |
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "cheating-daddy",
|
"name": "cheating-daddy",
|
||||||
"productName": "cheating-daddy",
|
"productName": "cheating-daddy",
|
||||||
"version": "0.5.2",
|
"version": "0.5.3",
|
||||||
"description": "cheating daddy",
|
"description": "cheating daddy",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+4
-60
@@ -35,71 +35,15 @@ function createWindow(sendToRenderer, geminiSessionRef) {
|
|||||||
const { session, desktopCapturer } = require('electron');
|
const { session, desktopCapturer } = require('electron');
|
||||||
|
|
||||||
// Setup display media request handler for screen capture
|
// Setup display media request handler for screen capture
|
||||||
if (process.platform === 'darwin') {
|
// Use system picker on all platforms to let user choose screen/window and audio
|
||||||
// On macOS, use SystemAudioDump for audio (not browser loopback)
|
|
||||||
// So we just need to capture the screen
|
|
||||||
session.defaultSession.setDisplayMediaRequestHandler(
|
|
||||||
async (request, callback) => {
|
|
||||||
try {
|
|
||||||
const sources = await desktopCapturer.getSources({
|
|
||||||
types: ['screen'],
|
|
||||||
thumbnailSize: { width: 0, height: 0 } // Skip thumbnail generation for speed
|
|
||||||
});
|
|
||||||
|
|
||||||
if (sources.length === 0) {
|
|
||||||
console.error('No screen sources available');
|
|
||||||
callback(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// On macOS, directly use the first screen (system already granted permission)
|
|
||||||
// Audio is handled separately by SystemAudioDump
|
|
||||||
console.log('Screen capture source:', sources[0].name);
|
|
||||||
callback({ video: sources[0], audio: 'loopback' });
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error getting screen sources:', error);
|
|
||||||
callback(null);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ useSystemPicker: false } // Disable system picker, use our source directly
|
|
||||||
);
|
|
||||||
} else if (process.platform === 'win32') {
|
|
||||||
// On Windows, use system picker so user can enable "Share audio" checkbox
|
|
||||||
// This is REQUIRED for system audio capture on Windows
|
|
||||||
session.defaultSession.setDisplayMediaRequestHandler(
|
session.defaultSession.setDisplayMediaRequestHandler(
|
||||||
(request, callback) => {
|
(request, callback) => {
|
||||||
console.log('Windows: Using system picker for screen/audio selection');
|
// Don't call callback - let system picker handle the selection
|
||||||
// Don't call callback - let system picker handle it
|
// The system will call callback with user's choice
|
||||||
// The system picker will provide both video and audio if user checks the box
|
console.log('Showing system screen picker dialog...');
|
||||||
},
|
},
|
||||||
{ useSystemPicker: true }
|
{ useSystemPicker: true }
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
// On Linux, try to get system audio via loopback
|
|
||||||
session.defaultSession.setDisplayMediaRequestHandler(
|
|
||||||
async (request, callback) => {
|
|
||||||
try {
|
|
||||||
const sources = await desktopCapturer.getSources({
|
|
||||||
types: ['screen'],
|
|
||||||
thumbnailSize: { width: 0, height: 0 }
|
|
||||||
});
|
|
||||||
|
|
||||||
if (sources.length === 0) {
|
|
||||||
console.error('No screen sources available');
|
|
||||||
callback(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Linux: Using screen source with loopback audio');
|
|
||||||
callback({ video: sources[0], audio: 'loopback' });
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error getting screen sources:', error);
|
|
||||||
callback(null);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ useSystemPicker: false }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.setResizable(false);
|
mainWindow.setResizable(false);
|
||||||
mainWindow.setContentProtection(true);
|
mainWindow.setContentProtection(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user