aboutsummaryrefslogtreecommitdiffstats
path: root/src/electron/windowUtils.js
blob: 23b946ac4d4b47a3f58a38f0a060c857451b899d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
/* eslint import/prefer-default-export: 0 */

import { screen } from 'electron';

export function isPositionValid(position) {
  const displays = screen.getAllDisplays();
  const { x, y } = position;
  return displays.some(({
    workArea,
  }) => x >= workArea.x && x <= workArea.x + workArea.width && y >= workArea.y && y <= workArea.y + workArea.height);
}