overwolf.windows API
Use this API to create, interact with and modify your app’s windows.
Please make sure to read our guide on how to use Overwolf windows, to learn everything about Overwolf app windows, and how to use them properly and efficiently in your app.
Methods Reference
- overwolf.windows.getMainWindow()
- overwolf.windows.getCurrentWindow()
- overwolf.windows.obtainDeclaredWindow()
- overwolf.windows.obtainDeclaredWindow()
- overwolf.windows.obtainDeclaredWindow()
- overwolf.windows.getWindow()
- overwolf.windows.dragMove()
- overwolf.windows.dragResize()
- overwolf.windows.dragResize()
- overwolf.windows.dragResize()
- overwolf.windows.changeSize()
- overwolf.windows.changeSize()
- overwolf.windows.changePosition()
- overwolf.windows.close()
- overwolf.windows.minimize()
- overwolf.windows.maximize()
- overwolf.windows.restore()
- overwolf.windows.restore()
- overwolf.windows.hide()
- overwolf.windows.getWindowState()
- overwolf.windows.getWindowsStates()
- overwolf.windows.openOptionsPage()
- overwolf.windows.setDesktopOnly()
- overwolf.windows.setRestoreAnimationsEnabled()
- overwolf.windows.setTopmost()
- overwolf.windows.sendToBack()
- overwolf.windows.sendMessage()
- overwolf.windows.setWindowStyle()
- overwolf.windows.removeWindowStyle()
- overwolf.windows.getOpenWindows()
- overwolf.windows.setMute()
- overwolf.windows.muteAll()
- overwolf.windows.isMuted()
- overwolf.windows.isWindowVisibleToUser()
- overwolf.windows.requestOverlayFocus()
- overwolf.windows.requestOverlayFocus()
- overwolf.windows.bringToFront()
- overwolf.windows.bringToFront()
- overwolf.windows.bringToFront()
- overwolf.windows.bringToFront()
- overwolf.windows.setPosition()
- overwolf.windows.setPosition()
- overwolf.windows.displayMessageBox()
- overwolf.windows.isAccelreatedOSR()
- overwolf.windows.setMinSize()
- overwolf.windows.flash()
- overwolf.windows.setZoom()
- overwolf.windows.setWidgetStyle()
- overwolf.windows.removeWidgetStyle()
Events Reference
- overwolf.windows.onMainWindowRestored
- overwolf.windows.onStateChanged
- overwolf.windows.onMessageReceived
- overwolf.windows.onAltF4Blocked
- overwolf.windows.onScreenPropertyChanged
Types Reference
- overwolf.windows.WindowProperties Object
- overwolf.windows.RelativeTo Object
- overwolf.windows.SetWindowPositionProperties Object
- overwolf.windows.MessageBoxParams Object
- overwolf.windows.ODKRect Object
- overwolf.windows.enums.MessagePromptIcon Enum
- overwolf.windows.enums.WindowDragEdge Enum
- overwolf.windows.enums.WindowStyle Enum
- overwolf.windows.enums.FlashBehavior Enum
- overwolf.windows.onScreenPropertyChangedEvent Object
- overwolf.windows.WindowStateChangedEvent Object
- overwolf.windows.WindowResult Object
- overwolf.windows.WindowInfo Object
- overwolf.windows.enums.WindowStateEx Enum
- overwolf.windows.DragMovedResult Object
- overwolf.windows.DragResizeResult Object
- overwolf.windows.WindowIdResult Object
- overwolf.windows.GetWindowStateResult Object
- overwolf.windows.GetWindowStatesResult Object
- overwolf.windows.IsMutedResult Object
- overwolf.windows.IsWindowVisibleToUserResult Object
- overwolf.windows.DisplayMessageBoxResult Object
- overwolf.windows.MessageReceivedEvent Object
- overwolf.windows.AltF4BlockedEvent Object
- overwolf.windows.widgetStyleObject Object
getMainWindow()
Version added: 0.113
Returns a window object of the index page.
This function allows you to get direct access to your main index page (which should be a controller/background page) and it’s HTML Window object (and thus any JS function or DOM element), which is also guaranteed to exist when calling this method from any other window (unlike the getOpenWindows()).
If you hold one global "manager" object in your background, then all other windows have a single object to interact with. This is why we recommend the getMainWindow() approach.
overwolf.windows.sendMessage performs object copying, so it might be a bit less efficient - depending on your use-case
Read more in the "Communication between windows" section.
getCurrentWindow(callback)
Version added: 0.78. updated: 0.153
Calls the given callback function with the current window object as a parameter.
| Parameter | Type | Description |
|---|---|---|
| callback | (Result: WindowResult) => void | A callback function which will be called with the current window object as a parameter |
Note
- The sizes returned in the callback already consider the DPI scaling.
obtainDeclaredWindow(windowName, callback)
Version added: 0.78
Creates an instance of your window (the window’s name has to be declared in the manifest.json) or returns a window by the window name.
| Parameter | Type | Description |
|---|---|---|
| windowName | string | The name of the window that was declared in the data.windows section in the manifest |
| callback | (Result: WindowResult) => void | A callback function which will be called with the current window object as a parameter |
Notes
- If the window does not exist - the function return null in the sizes.
- If the window exists - the sizes returned in the callback already consider the DPI scaling.
obtainDeclaredWindow(windowName, overrideSetting, callback)
Version added: 0.78
Creates an instance of your window (the window’s name has to be declared in the manifest.json) or returns a window by the window name.
| Parameter | Type | Description |
|---|---|---|
| windowName | string | The name of the window that was declared in the data.windows section in the manifest |
| overrideSetting | WindowProperties Object | Override manifest settings |
| callback | (Result: WindowResult) => void | A callback function which will be called with the current window object as a parameter |
Notes
- If the window does not exist - the function return null in the sizes.
- If the window exists - the sizes returned in the callback already consider the DPI scaling.
obtainDeclaredWindow(windowName, useDefaultSizeAndLocation, callback)
Version added: 0.136
Creates an instance of your window (the window’s name has to be declared in the manifest.json) or returns a window by the window name.
| Parameter | Type | Description |
|---|---|---|
| windowName | string | The name of the window that was declared in the data.windows section in the manifest |
| useDefaultSizeAndLocation | DefaultSizeAndLocation Object | Enable the manifest size and position settings |
| callback | (Result: WindowResult) => void | A callback function which will be called with the current window object as a parameter |
Usage example
overwolf.windows.obtainDeclaredWindow("main", {useDefaultSizeAndLocation: true}, console.log)
Notes
- If the window does not exist - the function return null in the sizes.
- If the window exists - the sizes returned in the callback already consider the DPI scaling.
getWindow(windowName, callback)
Version added: 0.191
Returns WindowResult object for a specific open window.
| Parameter | Type | Description |
|---|---|---|
| windowName | string | The name of the window that was declared in the data.windows section in the manifest |
| callback | (Result: WindowResult) => void | Callback will be invoked with the WindowResult object. |
Usage example
overwolf.windows.getWindow("main", console.log)
Notes
- If the window does not exist - returns an error.
dragMove(windowId, callback)
Version added: 0.78
Start dragging a window.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to drag |
| callback (Optional) | (Result: DragMovedResult) => void | A callback which is called when the drag is completed |
Notes
- When you dragMove a native window between monitors with different DPIs, the window will automatically resize according to the new DPI.
- When you quickly Click / DoubleClick a window that has dragMove(), without moving it at all - a "Left mouse released" error is thrown.
dragResize(windowId, edge)
Version added: 0.100
Start resizing the window from a specific edge or corner.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to resize |
| edge | WindowDragEdge Enum | The edge or corner from which to resize the window |
dragResize(windowId, edge, contentRect)
Version added: 0.100
Start resizing the window from a specific edge or corner.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to resize |
| edge | WindowDragEdge Enum | The edge or corner from which to resize the window |
| contentRect | ODKRect Object | The real content of the window (for the ingame drawing resizing white area) |
dragResize(windowId, edge, rect, callback)
Version added: 0.100
Start resizing the window from a specific edge or corner.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to resize |
| edge | WindowDragEdge Enum | The edge or corner from which to resize the window |
| rect | ODKRect Object | The real content of the window (for the ingame drawing resizing white area) |
| callback | (Result: DragResizeResult) => void | A callback which is called when the resizing process is completed |
changeSize(windowId, width, height, callback)
Version added: 0.78
Changes the window size to the new width and height, in pixels.
This function is Deprecated and doesn't calculate DPI - so you need to pre-calculate DPI before calling it, or, use this signature of that calculates DPI - so you don't need to calculate it yourself.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to resize |
| width | int | The new width to resize the window to |
| height | int | The new height to resize the window to |
| callback (Optional) | (Result) => void | Reports success or failure when the size change is completed. |
changeSize(changeSizeParams, callback)
Version added: 0.149
Changes the window size to the new width and height, in pixels, including DPI scale when resizing.
Notes
- This function calculates DPI, so you don't need to calculate it yourself.
- This function works for all the window types.
| Parameter | Type | Description |
|---|---|---|
| ChangeWindowSizeParams | ChangeWindowSizeParams Object | Container for the window settings |
| callback (Optional) | (Result) => void | Reports success or failure when the size change is completed. |
Usage example
let sizeSettings = {
"window_id":"Window_Extension_nhmkaollkcmjiecdnnjmgfifjgkfegkljnjjbipp",
"width":1000,
"height":1000,
"auto_dpi_resize":true //relevant only for native windows
};
overwolf.windows.changeSize(sizeSettings, console.log);
changePosition(windowId, left, top, callback)
Version added: 0.78
Changes the window position in pixels from the top left corner.
Note: changePosition() calculates DPI before changing position (so you should pass coordinates without calculating their DPI).
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window for which to change the position |
| left | int | The new window position on the X axis in pixels from the left |
| top | int | The new window position on the Y axis in pixels from the top |
| callback (Optional) | (Result) => void | Reports success or failure when the position change is completed. |
close(windowId, callback)
Version added: 0.78
Closes the window.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to close |
| callback (Optional) | (Result: WindowIdResult) => void | Called after the window is closed |
minimize(windowId, callback)
Version added: 0.78
Minimizes the window.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to minimize |
| callback (Optional) | (Result: WindowIdResult) => void | Called after the window is minimized |
Notes
minimize()will minimize the targeted window even when the manifest resizable flag is set tofalse.- When minimizing a native window, the window object values for
top,left,widthandheightare unexpected and shouldn't be regarded.
maximize(windowId, callback)
Version added: 0.81
Maximize the window.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to maximize |
| callback (Optional) | (Result: WindowIdResult) => void | Called after the window is maximized |
Notes
-
maximize()will maximize the targeted window even when the manifest resizable flag is set tofalse. -
In order to restore a maximized window to its previous state, call window.restore().
restore(windowId, callback)
Version added: 0.78
Restores a minimized/maximized/hidden window.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id of the window to restore |
| callback (Optional) | (Result: WindowIdResult) => void | Called after the window is restored |
Notes
- When restoring a minimized/maximized window, it restores the window to the previous size/position.
- When restoring a (non-desktop) window that is partly out of the game bounds, it repositions the window so that it fully fits inside the game bounds
- Read some usage tips here.
restore(windowName, callback)
Version added: 0.78
Restores a minimized/maximize/hidden window.
| Parameter | Type | Description |
|---|---|---|
| windowName | string | The id of the window to restore |
| callback (Optional) | (Result: WindowIdResult) => void | Called after the window is restored |
Notes
- When restoring a minimized/maximized window, it restores the window to the previous size/position.
- When restoring a (non-desktop) window that is partly out of the game bounds, it repositions the window so that it fully fits inside the game bounds
- Read some usage tips here.
hide(windowId, callback)
Version added: 0.108
Hides the window from screen and taskbar.
Note that the tray icon (if defined) visibility is not affected by calling this function.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to hide |
| callback | (Result: WindowIdResult) => void | Called after the window was hidden |
getWindowState(windowId, callback)
Version added: 0.85
Returns the state of the window (normal/minimized/maximized/closed).
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to restore |
| callback | (Result: GetWindowStateResult) => void | Called with the window state |
getWindowsStates(callback)
Version added: 0.90
Returns the state of all windows owned by the app (normal/minimized/maximized/closed).
| Parameter | Type | Description |
|---|---|---|
| callback | (Result: GetWindowsStatesResult) => void | Called with an array containing the states of the windows |
openOptionsPage(callback)
Version added: 0.89
Opens the options page specified in the manifest file. Does nothing if no such page has been specified.
| Parameter | Type | Description |
|---|---|---|
| callback | (Result) => void | Reports success or failure |
setDesktopOnly(windowId, shouldBeDesktopOnly, callback)
Version added: 0.89
Sets whether the window should be injected to games or not.
This function is Deprecated.
If you are using this function on an in-game window while you are in a game, the window will hide, but it will not appear on the desktop automatically. Nevertheless, we are always recommending to use different windows for in-game and desktop.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to set |
| shouldBeDesktopOnly | bool | |
| callback | (Result: WindowIdResult) => void | Called after the window was hidden |
setRestoreAnimationsEnabled(windowId, shouldEnableAnimations, callback)
Version added: 0.89
Sets whether the window should have minimize/restore animations while in game.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to set |
| shouldEnableAnimations | bool | |
| callback | (Result: WindowIdResult) => void | Called after the window was hidden |
setTopmost(windowId, shouldBeTopmost, callback)
Version added: 0.89
Change the window’s topmost status. Handle with care as topmost windows can negatively impact user experience.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to set |
| shouldBeTopmost | bool | |
| callback | (Result) => void | Reports success or failure |
sendToBack(windowId, callback)
Version added: 0.89
Sends the window to the back.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to set |
| shouldBeTopmost | bool | |
| callback | (Result) => void | Reports success or failure |
sendMessage(windowId, messageId, messageContent, callback)
Version added: 0.92
Sends a message to an open window.
The window receiving the message needs to listen on the onMessageReceived event.
Using sendMessage performs object copying, so it might be a bit less efficient - depending on your use-case. It is not our suggested choice for communication between windows since it might not work on some occasions (for example, when sending extremely big messages).
Read more in the Windows Communication guide.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to send the message to |
| messageId | string | A message id |
| messageContent | Object | The content of the message |
| callback | (Result) => void | Reports success or failure |
Usage example
overwolf.windows.sendMessage('secondWindow', '1', 'hello second window', ()=>{console.log('Message sent to window "secondWindow"')})
setWindowStyle(windowId, style, callback)
Version added: 0.98
Add Window In Game styling (for example, allowing mouse clicks to be passed through the window into the game)
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to style |
| style | WindowStyle Enum | The style to be added |
| callback | (Result) => void | Reports success or failure |
removeWindowStyle(windowId, style, callback)
Version added: 0.98
Remove window style.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window to style |
| style | WindowStyle Enum | The style to be removed |
| callback | (Result) => void | Reports success or failure |
getOpenWindows(callback)
Version added: 0.92
Returns an array of all open windows as objects. The objects can be manipulated like any other window.
we highly recommend not to use getOpenWindows() for windows communication.
Please read the "Communicating between windows" section for more info.
| Parameter | Type | Description |
|---|---|---|
| callback | function | A callback function which will be called with a map object of (window-name, Window Object) items |
setMute(mute, callback)
Version added: 0.102
Set the current window mute state (on/off).
| Parameter | Type | Description |
|---|---|---|
| mute | bool | Window mute state (true - mute is on, false - mute is off) |
| callback | (Result) => void | Reports success or failure |
muteAll(callback)
Version added: 0.102
Mutes all sound sources for the current window.
| Parameter | Type | Description |
|---|---|---|
| callback | (Result) => void | Called with the result of the request |
isMuted(callback)
Version added: 0.102
Get the window’s mute state (true/false).
| Parameter | Type | Description |
|---|---|---|
| callback | (Result: IsMutedResult) => void | Called with the result of the request {"muted": true/false} |
isWindowVisibleToUser(callback)
Version added: 0.102
Get the Visibility state of the window.
Used only with windows without a transparent border.
| Parameter | Type | Description |
|---|---|---|
| callback | (Result: IsWindowVisibleToUserResult) => void | Called with the result of the request {"visible": hidden/fully/partial} |
requestOverlayFocus(callback)
Version added: 0.250
Attempts to grab focus from the game to the current window
| Parameter | Type | Description |
|---|---|---|
| callback | (Result) => void | Called with the result of the request |
Notes
- This method must be called on an Overlay window (
native_window=false). - The target window must be visible (not minimized/hidden/closed).
- The game must currently have the system's focus.
- This method behaves differently depending on the Overlay type:
- Standard Overlay - This method will simply grab focus from the game.
- Exclusive Mode Overlay - This method will only work while Exclusive mode is active.
requestOverlayFocus(windowId, callback)
Version added: 0.250
Attempts to grab focus from the game to the specified window window
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The name of the window |
| callback | (Result) => void | Called with the result of the request |
Notes
- This method must be called on an Overlay window (
native_window=false). - The target window must be visible (not minimized/hidden/closed).
- The game must currently have the system's focus.
- This method behaves differently depending on the Overlay type:
- Standard Overlay - This method will simply grab focus from the game.
- Exclusive Mode Overlay - This method will only work while Exclusive mode is active.
bringToFront(windowId, callback)
Version added: 0.119
Brings the requested window to the front.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window |
| callback | (Result) => void | Called with the result of the request |
Notes
- For in-game windows, calling this function will always bring the window to the front.
- For desktop/native windows, the behavior depends on the game mode:
- Fullscreen game: The window will stay in the background behind the game. If you want to take focus, use the grabFocus version.
- Windowed game: The window will move to the foreground. The game window will not be changed.
bringToFront(callback)
Version added: 0.119
Brings this window to the front.
Notes
- For in-game windows, calling this function will always bring the window to the front.
- For desktop/native windows, the behavior depends on the game mode:
- Fullscreen game: The window will stay in the background behind the game. If you want to take focus, use the grabFocus version.
- Windowed game: The window will move to the foreground. The game window will not be changed.
| Parameter | Type | Description |
|---|---|---|
| callback | (Result) => void | Called with the result of the request |
bringToFront(grabFocus, callback)
Version added: 0.124
Brings this window to the front.
Notes
- For in-game windows, calling this function will always bring the window to the front.
- For desktop/native windows, the behavior depends on the game mode AND the grabFocus param:
- Fullscreen game + grabFocus:false - The window will stay in the background behind the game.
- Fullscreen game + grabFocus:true - The window will move to the foreground and take the focus. The game window will be minimized (use with caution, usually it's a bad UX).
- Windowed game + grabFocus:true/false - The window will move to the foreground. The game window will not be changed.
| Parameter | Type | Description |
|---|---|---|
| grabFocus | bool | window will take system focus |
| callback | (Result) => void | Called with the result of the request |
bringToFront(windowId, grabFocus, callback)
Version added: 0.124
Brings a window to the front.
Notes
- For in-game windows, calling this function will always bring the window to the front.
- For desktop/native windows, the behavior depends on the game mode AND the grabFocus param:
- Fullscreen game + grabFocus:false - The window will stay in the background behind the game.
- Fullscreen game + grabFocus:true - The window will move to the foreground and take the focus. The game window will be minimized (use with caution, usually it's a bad UX).
- Windowed game + grabFocus:true/false - The window will move to the foreground. The game window will not be changed.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window |
| grabFocus | bool | window will take system focus |
| callback | (Result) => void | Called with the result of the request |
setPosition(properties, callback)
Version added: 0.123
Change this window location in the opened windows stack.
| Parameter | Type | Description |
|---|---|---|
| properties | SetWindowPositionProperties Object | The desired location in the windows stack |
| callback | (Result) => void | Called with the result of the request |
Usage Example
Using the following code will place your app window in front of League of Legends’ client window:
overwolf.windows.setPosition({
"relativeTo": {
"processName": "LeagueClientUx",
"windowTitle": "League of Legends"
},
"insertAbove": true,
},
console.log);
setPosition(windowId, properties, callback)
Version added: 0.123
Change a window location in the opened windows stack.
| Parameter | Type | Description |
|---|---|---|
| windowId | string | The id or name of the window |
| properties | SetWindowPositionProperties Object | The desired location in the windows stack |
| callback | (Result) => void | Called with the result of the request |
displayMessageBox(messageParams, callback)
Version added: 0.119
Displays a customized popup message prompt.
| Parameter | Type | Description |
|---|---|---|
| messageParams | MessageBoxParams Object | The type and texts that the message prompt will have |
| callback | (Result: DisplayMessageBoxResult) => void | Returns the user's action (confirmed = true / false) |
Usage Example
Using the following code will create a pop up message for your app:
overwolf.windows.displayMessageBox({
message_title: "title_text",
message_body: "body_text",
confirm_button_text: "Confirm",
cancel_button_text: "Cancel",
message_box_icon: overwolf.windows.enums.MessagePromptIcon.ExclamationMark
},console.log)
isAccelreatedOSR(callback)
Version added: 0.126
Is the current window accelerated and is OSR |GPU| acceleration is supported for this machine.
Note that the function name is misspelled. It is kept this way for backwards compatibility.
The OSR acceleration feature is is no longer supported and maintained.
| Parameter | Type | Description |
|---|---|---|
| callback | (Result) => void | Called with the result of the request |
Callback argument: Success
A callback function which will be called with the status of the request
{
"success": true,
"status": "success", //for backward compatibility
"accelerated":false,
"supported":true,
"optimized": true
}