From b2b95de669fa94c08dce57055392925b99620911 Mon Sep 17 00:00:00 2001 From: Johan Kwarnmark Date: Mon, 11 May 2020 15:33:33 +0200 Subject: [PATCH 1/3] the user may have closed the screen share indicator so we can not be depending on that --- src/app/window-handler.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 6b8b30bb..c6eb84d9 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -507,14 +507,13 @@ export class WindowHandler { if (browserWindow && windowExists(browserWindow)) { browserWindow.destroy(); - - if (isWindowsOS || isMac) { - this.execCmd(this.screenShareIndicatorFrameUtil, []); - } else { - if (this.screenSharingFrameWindow && windowExists(this.screenSharingFrameWindow)) { - this.screenSharingFrameWindow.close(); - } - } + } + } + if (isWindowsOS || isMac) { + this.execCmd(this.screenShareIndicatorFrameUtil, []); + } else { + if (this.screenSharingFrameWindow && windowExists(this.screenSharingFrameWindow)) { + this.screenSharingFrameWindow.close(); } } break; From 948ea35fbfb9b1b779ca7938bac826e225054687 Mon Sep 17 00:00:00 2001 From: Johan Kwarnmark Date: Tue, 12 May 2020 11:00:44 +0200 Subject: [PATCH 2/3] Printout all displays --- src/app/window-handler.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index c6eb84d9..238fec66 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -718,6 +718,12 @@ export class WindowHandler { this.addWindow(opts.winKey, this.screenPickerWindow); }); ipcMain.once('screen-source-selected', (_event, source) => { + const displays = electron.screen.getAllDisplays(); + logger.info('window-utils: displays.length: ' + displays.length); + for (let i = 0, len = displays.length; i < len; i++) { + logger.info('window-utils: display[' + i + ']: ' + JSON.stringify(displays[ i ])); + } + if (source != null) { logger.info(`window-handler: screen-source-selected`, source, id); if (isWindowsOS || isMac) { From 0b3d9571e526aa40c7be06cb943cc43874648d34 Mon Sep 17 00:00:00 2001 From: Johan Kwarnmark Date: Tue, 12 May 2020 12:07:36 +0200 Subject: [PATCH 3/3] if display_id is empty we get it from getalldisplays --- src/app/window-handler.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 238fec66..79349213 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -739,7 +739,13 @@ export class WindowHandler { if (source.display_id !== '') { this.execCmd(this.screenShareIndicatorFrameUtil, [ source.display_id ]); } else { - this.execCmd(this.screenShareIndicatorFrameUtil, [ '0' ]); + const dispId = source.id.split(':')[1]; + const keyId = 'id'; + + logger.info('window-utils: dispId: ' + dispId); + logger.info('window-utils: displays [' + dispId + '] [id]: ' + displays [dispId] [ keyId ]); + + this.execCmd(this.screenShareIndicatorFrameUtil, [ displays [dispId] [ keyId ].toString() ]); } } }