aboutsummaryrefslogtreecommitdiffstats
path: root/src/electron/windowUtils.ts
blob: 654459320a5c0457e9adb91d58b38fef9043ccd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { screen } from 'electron';

export default function isPositionValid(position: {
  x: number;
  y: number;
}): boolean {
  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,
  );
}