Module: helpers/utils/window
Table of contents
Functions
Functions
ensureVisibleOnSomeDisplay
▸ ensureVisibleOnSomeDisplay(windowState
, defaultSize
): Rectangle
Ensures that the window is visible on at least one display. If the window is not visible, resets it to default size and position.
Parameters
Name | Type | Description |
---|---|---|
windowState | Rectangle | The current state of the window. |
defaultSize | Object | The default size of the window. |
defaultSize.height | number | - |
defaultSize.width | number | - |
Returns
Rectangle
The adjusted window state, ensuring it's visible on a display.
Defined in
src/electron/helpers/utils/window.ts:60 (opens in a new tab)
getCurrentPosition
▸ getCurrentPosition(win
): Rectangle
Retrieves the current position and size of the given BrowserWindow.
Parameters
Name | Type | Description |
---|---|---|
win | BrowserWindow | The Electron BrowserWindow instance. |
Returns
Rectangle
An object containing x and y coordinates, and width and height of the window.
Defined in
src/electron/helpers/utils/window.ts:10 (opens in a new tab)
resetToDefaults
▸ resetToDefaults(defaultSize
): Rectangle
Resets the window size to default values and centers it on the primary display.
Parameters
Name | Type | Description |
---|---|---|
defaultSize | Object | The default width and height for the window. |
defaultSize.height | number | - |
defaultSize.width | number | - |
Returns
Rectangle
The new window state with default size and centered position.
Defined in
src/electron/helpers/utils/window.ts:43 (opens in a new tab)
windowWithinBounds
▸ windowWithinBounds(windowState
, bounds
): boolean
Checks if a window's state is within the specified bounds.
Parameters
Name | Type | Description |
---|---|---|
windowState | Rectangle | The state of the window, including position and size. |
bounds | Rectangle | The bounding rectangle to compare against. |
Returns
boolean
Returns true if the window's state is within the bounds, otherwise false.
Defined in
src/electron/helpers/utils/window.ts:28 (opens in a new tab)