mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-24 23:05:49 +00:00
fix(linux): allow full-screen capture by matching display sources by position if IDs do not match (fixes #265)
This commit is contained in:
@@ -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)`
|
||||
|
||||
Reference in New Issue
Block a user