before its fucked again
This commit is contained in:
@@ -44,11 +44,35 @@ app.on('window-all-closed', () => {
|
||||
|
||||
// Handle IPC request from renderer to get screen/audio sources
|
||||
ipcMain.handle('get-sources', async () => {
|
||||
const inputSources = await desktopCapturer.getSources({
|
||||
let inputSources = await desktopCapturer.getSources({
|
||||
types: ['window', 'screen'],
|
||||
fetchWindowIcons: true
|
||||
});
|
||||
|
||||
// Wayland Workaround: If we only see generic "WebRTC PipeWire capturer" windows,
|
||||
// try to fetch real window titles via our python helper
|
||||
try {
|
||||
const genericNames = ['webrtc pipewire capturer', 'screen 1', 'screen 2'];
|
||||
const hasGeneric = inputSources.some(s => genericNames.includes(s.name.toLowerCase()));
|
||||
|
||||
if (hasGeneric || inputSources.length === 1) {
|
||||
const { execSync } = require('child_process');
|
||||
const pyPath = path.join(__dirname, 'wayland-helper.py');
|
||||
const out = execSync(`python3 ${pyPath}`, { timeout: 2000 }).toString();
|
||||
const waylandWindows = JSON.parse(out);
|
||||
|
||||
if (waylandWindows && waylandWindows.length > 0) {
|
||||
// If we only have 1 capturer source (common on Wayland compositors),
|
||||
// rename it to the first active window title we found to be helpful.
|
||||
if (inputSources.length === 1 && waylandWindows[0].title) {
|
||||
inputSources[0].name = waylandWindows[0].title;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Wayland helper failed:", e.message);
|
||||
}
|
||||
|
||||
return inputSources.map(source => ({
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
@@ -65,6 +89,10 @@ ipcMain.handle('link-app-audio', async (event, appName) => {
|
||||
return await PipewireHelper.linkApplicationToMic(appName);
|
||||
});
|
||||
|
||||
ipcMain.handle('link-monitor-audio', async () => {
|
||||
return await PipewireHelper.linkMonitorToMic();
|
||||
});
|
||||
|
||||
// Handle saving and loading the config.json profile
|
||||
const fs = require('fs');
|
||||
const configPath = path.join(__dirname, 'config.json');
|
||||
|
||||
Reference in New Issue
Block a user