Skip to content
Merged
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
11 changes: 10 additions & 1 deletion electron/ipc/register/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,19 @@ export function registerSourceHandlers({
.filter((source) => source.id.startsWith("screen:"))
.map((source) => [String(source.display_id ?? ""), source] as const),
);
// On Linux, desktopCapturer display_id values may not match screen.getAllDisplays() IDs.
// Keep an ordered list so we can fall back to position-based matching.
const electronScreenSourcesByIndex = electronSources.filter((source) =>
source.id.startsWith("screen:"),
);

const screenSources = displays.map((display, index) => {
const displayId = String(display.id);
const matchedSource = electronScreenSourcesByDisplayId.get(displayId);
const matchedSource =
electronScreenSourcesByDisplayId.get(displayId) ??
(electronScreenSourcesByIndex.length === displays.length
? electronScreenSourcesByIndex[index]
: undefined);
const displayName =
displayId === primaryDisplayId
? `Screen ${index + 1} (Primary)`
Expand Down