diff --git a/js/screenSnippet/index.js b/js/screenSnippet/index.js index 5069ef84..ed64d305 100644 --- a/js/screenSnippet/index.js +++ b/js/screenSnippet/index.js @@ -10,10 +10,12 @@ const path = require('path'); const { isMac, isDevEnv } = require('../utils/misc.js'); const log = require('../log.js'); const logLevels = require('../enums/logLevels.js'); +const eventEmitter = require('.././eventEmitter'); // static ref to child process, only allow one screen snippet at time, so // hold ref to prev, so can kill before starting next snippet. let child; +let isAlwaysOnTop; /** * Captures a user selected portion of the monitor and returns jpeg image @@ -61,6 +63,17 @@ class ScreenSnippet { captureUtil = path.join(execPath, 'ScreenSnippet.exe'); } + // Method to verify and disable always on top property + // as an issue with the ScreenSnippet.exe not being on top + // of the electron wrapper + const windows = electron.BrowserWindow.getAllWindows(); + if (windows && windows.length > 0) { + isAlwaysOnTop = windows[ 0 ].isAlwaysOnTop(); + if (isAlwaysOnTop) { + eventEmitter.emit('isAlwaysOnTop', false); + } + } + captureUtilArgs = [outputFileName]; } @@ -72,6 +85,10 @@ class ScreenSnippet { } child = childProcess.execFile(captureUtil, captureUtilArgs, (error) => { + // Method to reset always on top feature + if (isAlwaysOnTop) { + eventEmitter.emit('isAlwaysOnTop', true); + } // will be called when child process exits. if (error && error.killed) { // processs was killed, just resolve with no data.