Skip to main content

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

PropertyModifierTypeDescription
idreadonlynumberID assigned to the overlay window.
namereadonlystringUnique name for the overlay window.
overlayOptionsreadonlyOverlayOptionsOverlay specific configuration options used when this window was created. See OverlayOptions.
scaleFactorreadonlynumberThe window DPI in percentage (1.25 = 125%).
windowpublicBrowserWindow-

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();
});