window
Control operations for plugin window display, hide, fullscreen, etc.
Below are common examples of window functionalities:
await eagle.window.show();            // Show plugin window
await eagle.window.hide();            // Hide plugin window
await eagle.window.minimize();        // Minimize window
await eagle.window.restore();         // Restore minimized
await eagle.window.maximize();        // Maximize window
await eagle.window.unmaximize();      // Restore maximized
await eagle.window.setFullScreen(true);       // Set to fullscreen
await eagle.window.setFullScreen(false);      // Exit fullscreenMethods
show()
Show and focus the window.
- Returns - Promise<>
await eagle.window.show();showInactive()
Show the window but don't focus on it.
- Returns - Promise<>
await eagle.window.showInactive();hide()
Hide the plugin window.
- Returns - Promise<>
await eagle.window.hide();focus()
Give the plugin window focus.
- Returns - Promise<>
await eagle.window.focus();minimize()
Minimize the plugin window.
- Returns - Promise<>
await eagle.window.minimize();isMinimized()
Determine if the window is minimized.
- Returns - Promise<minimized: boolean>- minimizedboolean - Whether the window is minimized
 
let isMinimized = await eagle.window.isMinimized();restore()
Restore the plugin window from a minimized state to its previous state.
- Returns - Promise<>
await eagle.window.restore();maximize()
Maximize the plugin window. If the window has not yet been displayed, this method will also show it (but not focus on it).
- Returns - Promise<>
await eagle.window.maximize();unmaximize()
Unmaximize the plugin window.
- Returns - Promise<>
await eagle.window.unmaximize();isMaximized()
Determine if the window is maximized.
- Returns - Promise<maximized: boolean>- maximizedboolean - Whether the window is maximized
 
let isMaximized = await eagle.window.isMaximized();setFullScreen(flag)
Set whether the window should be in fullscreen mode.
- flagboolean - Whether to set as fullscreen
- Returns - Promise<>
await eagle.window.setFullScreen(true);        // Enter fullscreen
await eagle.window.setFullScreen(false);       // Exit fullscreenisFullScreen()
Determine if the window is in fullscreen mode.
- Returns - Promise<fullscreen: boolean>- fullscreenboolean - Whether the window is in fullscreen
 
let isMaximized = await eagle.window.isMaximized();setAspectRatio(aspectRatio)
This will make the window maintain its aspect ratio.
- aspectRatioFloat - The aspect ratio to maintain (width / height)
- Returns - Promise<>
await eagle.window.setAspectRatio(16/9);        // Restrict the window aspect ratio to 16:9setBackgroundColor(backgroundColor)
Set the background color of the window.
- backgroundColorString - This parameter represents the HEX code of your desired background color.
- Returns - Promise<>
await eagle.window.setBackgroundColor("#FFFFFF");setSize(width, height)
Set window size.
- widthInteger - window width
- height- Integer - window height
- Returns - Promise<>
await eagle.window.setSize(720, 480);getSize()
Get window size.
- Returns - Promise<Integer[]>
await eagle.window.getSize();setBounds(bounds)
Adjust the window size and move it to the provided bounds. Any properties not provided will default to their current values.
await eagle.window.setBounds({ x: 440, y: 225, width: 800, height: 600 })getBounds()
Get window bounds.
- Returns - Promise<Rectangle[]>- object representing the window bounds
await eagle.window.getBounds()setResizable(resizable)
Set whether the window supports resizing.
- resizableboolean - whether resizing is supported
- Returns - Promise<>
await eagle.window.setResizable(true);
await eagle.window.setResizable(false);isResizable()
Whether the window supports resizing.
- Returns - Promise<resizable: boolean>- resizableboolean
 
let isResizable = await eagle.window.isResizable();setAlwaysOnTop(flag)
Set whether the window should always be displayed in front of other windows.
- flagboolean
- Returns - Promise<>
await eagle.window.setAlwaysOnTop(true);
await eagle.window.setAlwaysOnTop(false);isAlwaysOnTop()
Whether the window should always be displayed in front of other windows.
- Returns - Promise<alwaysOnTop: boolean>- alwaysOnTopboolean
 
let isAlwaysOnTop = await eagle.window.isAlwaysOnTop();setPosition(x, y)
Move the window to x and y.
- xInteger
- yInteger
- Returns - Promise<>
await eagle.window.setPosition(100, 200);getPosition()
Get plugin window coordinates x and y.
- Returns - Promise<position: Integer[]>- positionInteger[]- x - position[0] 
- y - position[1] 
 
 
let position = await eagle.window.getPosition();  // [100, 200]setOpacity(opacity)
Set the opacity of the window, values outside the range are limited to the [0, 1] range.
- opacitynumber - between 0.0 (completely transparent) and 1.0 (completely opaque)
- Returns - Promise<>
await eagle.window.setOpacity(0.5);getOpacity()
Get window opacity, between 0.0 (completely transparent) and 1.0 (completely opaque).
- Returns - Promise<opacity: number>- opacitynumber
 
let opacity = await eagle.window.getOpacity();flashFrame(flag)
Start or stop flashing the window to attract the user's attention.
- flagboolean - whether to flash
- Returns - Promise<>
await eagle.window.flashFrame(true);
await eagle.window.flashFrame(false);setIgnoreMouseEvents(ignore)
Ignore all mouse events within the window. All mouse events occurring in this window will be passed to the window below it but if this window has focus, it will still receive keyboard events.
- ignoreboolean - whether to ignore mouse events
- Returns - Promise<>
await eagle.window.setIgnoreMouseEvents(true);
await eagle.window.setIgnoreMouseEvents(false);capturePage(rect)
Capture a snapshot of the page within the specified rect area. Omitting rect will capture the entire visible page.
- rectobject - Optional, screenshot range- xnumber
- ynumber
- widthnumber
- heightnumber
 
- Returns - Promise<[NativeImage](https://www.electronjs.org/docs/latest/api/native-image)>
const image = await eagle.window.capturePage();
const base64 = image.toDataURL("image/jpeg");
const image2 = await eagle.window.capturePage({ x: 0, y: 0, width: 100, height: 50 });
const buffer = image2.toPNG();setReferer(url)
Sets the current referer URL. Once set, subsequent requests will utilize this referer.
- urlstring - The URL of the referer.
- Returns - void
eagle.window.setReferer("https://en.eagle.cool");Last updated
