Skip to content

Commit

Permalink
Open cerebro window on Active screen (#416)
Browse files Browse the repository at this point in the history
* Open cerebro window on Active screen

* remove blank line
  • Loading branch information
brpaz authored and ogustavo-pereira committed Feb 17, 2022
1 parent 5088769 commit 4108f8b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/lib/getWindowPosition.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion app/main/createWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4108f8b

Please sign in to comment.