MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / isWindowVisibleOnAnyDisplay

Function isWindowVisibleOnAnyDisplay

projects/electron/src/executor.ts:49–64  ·  view source on GitHub ↗
(rect: Rectangle)

Source from the content-addressed store, hash-verified

47}
48
49const 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
66export const defaultExecutorBounds = (): Rectangle => {
67 const currentDisplay = screen.getDisplayNearestPoint(screen.getCursorScreenPoint())

Callers 1

loadLastWindowSizeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected