Neutralino.window
The Neutralino.window
namespace contains methods related to the current native window instance.
This namespace's methods will work only for the window
mode.
#
window.setTitle(title)Sets the title of the native window.
#
Parameterstitle
String (optional): Title of the window. Clears the title, if the function was called without the parameter.
#
window.getTitle()Returns the title of the native window.
#
Return String (awaited):The current title of the native window instance.
#
window.minimize()Minimizes the native window.
#
window.maximize()Maximizes the native window.
#
window.unmaximize()Restores the native window.
#
window.isMaximized()Returns true
if the native window is maximized.
#
Return Boolean (awaited):true
orfalse
based on current maximized status.
#
window.setFullScreen()Enables the full screen mode.
#
window.exitFullScreen()Exits from the full screen mode.
#
window.isFullScreen()Returns true
if the native window is in the full screen mode.
#
Return Boolean (awaited):true
orfalse
based on current full screen status.
#
window.show()Shows the native window.
#
window.hide()Hides the native window.
#
window.isVisible()Returns true
if the native window is visible.
#
Return Boolean (awaited):true
orfalse
based on current visibility status.
#
window.focus()Focuses the native window.
#
window.setAlwaysOnTop(onTop)Activates or deactivates the always on top mode.
#
ParametersonTop
Boolean (optional): Says whether the on top mode should be activated or not. The default value istrue
.
#
window.move(x, y)Moves the native window into given coordinates. Neutralinojs's cross-platform coordinate system starts from top-left corner of the screen.
In other words, x=0,y=0
point refers to the top-left corner of the device's main screen.
#
Parametersx
Number: An integer value for the horizontal position.y
Number: An integer value for the vertical position.
#
window.center()Centers the native app window within the current display.
#
window.setIcon(icon)Sets an icon for the native window or Dock.
#
Parametersicon
String: Path of the icon. A200x200
PNG image file works fine on all supported operating systems.
#
window.setDraggableRegion(domId)Converts a given DOM element to a draggable region. The user will be able to drag the native window by dragging the given DOM element. This feature is suitable to make custom window bars along with the borderless mode.
#
ParametersdomId
String | HTMLElement: A DOM element identifier.
#
window.unsetDraggableRegion(domId)Converts a draggable region to a normal DOM elements by removing drag event handlers.
#
ParametersdomId
String | HTMLElement: A DOM element identifier.
#
window.setSize(Options)This method sets the size of the window.
#
Optionswidth
Number (optional): Window width in pixels.height
Number (optional): Window height in pixels.minWidth
Number (optional): Minimum width of the window in pixels.minHeight
Number (optional): Minimum height of the window in pixels.maxWidth
Number (optional): Maximum width of the window in pixels.maxHeight
Number (optional): Maximum height of the window in pixels.resizable
Boolean (optional): A boolean value to make the window resizable or fixed.
This method always expects width and height couples.
For example, if you are setting minWidth
, you should set minHeight
too.
#
window.getSize()Returns window size information.
#
Return Boolean (awaited):width
Number: Window width in pixels.height
Number: Window height in pixels.minWidth
Number Minimum width of the window in pixels.minHeight
Number: Minimum height of the window in pixels.maxWidth
Number: Maximum width of the window in pixels.maxHeight
Number: Maximum height of the window in pixels.resizable
Boolean: Says whether the window resizable or fixed.
#
window.getPosition()Returns window position coordinates.
#
Return Boolean (awaited):x
Number: Horizontal coordinate of the left edge of the window.y
Number: Vertical coordinate of the top edge of the window.
#
window.create(url, WindowOptions)Creates a native window. You can use this method to create new window for your multi-window Neutralinojs app. Neutralinojs spawns a new process for each native window. Therefore, the new window works as an isolated app once the window is created.
However, you can build communication streams between windows with the storage API.
#
Parametersurl
String: URL to be loaded. Eg:/resources/aboutWindow.html
. Supports loading both local and remote app resources. Local resource paths need to begin with/
.options
(optional): an instance ofWindowOptions
type.
#
WindowOptionstitle
String: Window title.icon
String: Window icon path.fullScreen
Boolean: Sets full screen mode.alwaysOnTop
Boolean: Activates the top-most mode.enableInspector
Boolean: Activates developer tools and opens the web inspector window.borderless
Boolean: Makes the window borderless.maximize
Boolean: Launches the window maximized.hidden
Boolean: Hides the window.maximizable
Boolean: Makes the window maximizable or not.exitProcessOnClose
Boolean: Exits the application process when the user clicks the window's close button.processArgs
String: Additional command-line arguments for the new window process.
#
Return Object (awaited):pid
Number: Process identifier.stdOut
String: Standard output. This value is always empty since the new window process starts asynchronously.stdErr
String: Standard error. This value is always empty since the new window process starts asynchronously.exitCode
Number: Exit code of the process.