OverlayBrowserWindow
Electron APIs / overlay / OverlayBrowserWindow
Represents an overlay window instance.
Wraps an Electron BrowserWindow with metadata and configuration specific to the overlay:
- Name.
- ID.
- Display behavior.
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
id | readonly | number | ID assigned to the overlay window. |
name | readonly | string | Unique name for the overlay window. |
overlayOptions | readonly | OverlayOptions | Overlay specific configuration options used when this window was created. See OverlayOptions. |
scaleFactor | readonly | number | The window DPI in percentage (1.25 = 125%). |
window | public | BrowserWindow | - |
Methods
startDragging()
startDragging(): void;
Initiates dragging of the overlay window.
Works only when the window is both visible and focused.
Triggered by the mousedown event on the overlay window.
You can achieve the same behavior by applying
the CSS property -webkit-app-region: drag to the draggable element.
Returns
void
Example
renderer: const startDraggingButton = document.getElementById("startDragging");
startDraggingButton.addEventListener("mousedown", () => {
ipcRenderer.send("startDraggingOsr");
});
main: ipcMain.on("startDraggingOsr", (e) => {
const overlayWindow = this.overlayApi.fromWebContents(e.sender);
if (!overlayWindow) {
return;
}
overlayWindow.startDragging();
});