(rect: Rectangle)
| 47 | } |
| 48 | |
| 49 | const isWindowVisibleOnAnyDisplay = (rect: Rectangle): boolean => { |
| 50 | const displays = screen.getAllDisplays() |
| 51 | // Ensure at least part of the title bar region (100×30px) is within |
| 52 | // a display's workArea so the user can drag/interact with the window. |
| 53 | const minVisibleWidth = 100 |
| 54 | const minVisibleHeight = 30 |
| 55 | for (const display of displays) { |
| 56 | const wa = display.workArea |
| 57 | const overlapX = Math.max(0, Math.min(rect.x + minVisibleWidth, wa.x + wa.width) - Math.max(rect.x, wa.x)) |
| 58 | const overlapY = Math.max(0, Math.min(rect.y + minVisibleHeight, wa.y + wa.height) - Math.max(rect.y, wa.y)) |
| 59 | if (overlapX > 0 && overlapY > 0) { |
| 60 | return true |
| 61 | } |
| 62 | } |
| 63 | return false |
| 64 | } |
| 65 | |
| 66 | export const defaultExecutorBounds = (): Rectangle => { |
| 67 | const currentDisplay = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()) |
no outgoing calls
no test coverage detected