From dc1bcb8e41c72e550133218f59d220df098c19a6 Mon Sep 17 00:00:00 2001 From: Bruno Paz <184563+brpaz@users.noreply.github.com> Date: Wed, 3 Mar 2021 03:24:47 +0000 Subject: [PATCH] feat: Open cerebro window on Active screen (#416) * Open cerebro window on Active screen * remove blank line --- app/lib/getWindowPosition.js | 5 ++++- app/main/createWindow.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/lib/getWindowPosition.js b/app/lib/getWindowPosition.js index 973e70d1..3d029935 100644 --- a/app/lib/getWindowPosition.js +++ b/app/lib/getWindowPosition.js @@ -28,7 +28,10 @@ export default ({ width, heightWithResults }) => { ? heightWithResults : MIN_VISIBLE_RESULTS * RESULT_HEIGHT + INPUT_HEIGHT - const display = screen.getPrimaryDisplay() + const display = screen.getDisplayNearestPoint( + screen.getCursorScreenPoint() + ) + const positions = config.get('positions') || {} if (display.id in positions) { diff --git a/app/main/createWindow.js b/app/main/createWindow.js index e9d6eae2..c60bb1be 100644 --- a/app/main/createWindow.js +++ b/app/main/createWindow.js @@ -69,7 +69,10 @@ export default ({ src, isDev }) => { if (!mainWindow.isVisible()) { return } - const display = screen.getPrimaryDisplay() + const display = screen.getDisplayNearestPoint( + screen.getCursorScreenPoint() + ) + const positions = config.get('positions') || {} positions[display.id] = mainWindow.getPosition() config.set('positions', positions)