Skip to content
Open
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
21 changes: 7 additions & 14 deletions apps/ui-tars/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ const initializeApp = async () => {
(source) => source.display_id === primaryDisplay.id.toString(),
);

callback({ video: primarySource!, audio: 'loopback' });
if (!primarySource) {
logger.warn('Primary display source not found, using first available source');
callback({ video: sources[0] || null, audio: 'loopback' });
} else {
callback({ video: primarySource, audio: 'loopback' });
}
});
},
{ useSystemPicker: false },
Expand Down Expand Up @@ -202,18 +207,6 @@ const registerIPCHandlers = (
return { unsubscribe };
};

/**
* Add event listeners...
*/

app.on('window-all-closed', () => {
// Respect the OSX convention of having the application in memory even
// after all windows have been closed
if (process.platform !== 'darwin') {
app.quit();
}
});

app
.whenReady()
.then(async () => {
Expand All @@ -231,4 +224,4 @@ app
logger.info('app.whenReady end');
})

.catch(console.log);
.catch(logger.error);