Window API
The Window API provides methods to create, manage, and control application windows in NativePHP Desktop.Opening Windows
Native\Desktop\Facades\Window::open()
Create a new window with the specified ID.Unique identifier for the window
Returns a PendingOpenWindow instance for configuring the window before it opens
Window Management
close()
Close a window by its ID.Window ID to close. If null, closes the current window.
hide()
Hide a window without closing it.Window ID to hide. If null, hides the current window.
show()
Show a previously hidden window.Window ID to show. If null, shows the current window.
current()
Get the current window instance.Returns the current Window object with all properties
all()
Get all open windows.Returns an array of Window objects
get()
Get a specific window by its ID.Window ID to retrieve
Returns the Window object
Window Sizing
resize()
Resize a window to the specified dimensions.New width in pixels
New height in pixels
Window ID to resize. If null, resizes the current window.
position()
Set the window position on screen.X coordinate in pixels
Y coordinate in pixels
Whether to animate the position change
Window ID to position. If null, positions the current window.
maximize()
Maximize a window.Window ID to maximize. If null, maximizes the current window.
minimize()
Minimize a window.Window ID to minimize. If null, minimizes the current window.
Window Behavior
alwaysOnTop()
Set whether the window should always stay on top of other windows.Whether to keep window on top
Window ID. If null, applies to the current window.
reload()
Reload the window’s content.Window ID to reload. If null, reloads the current window.
Window Configuration Methods
These methods are chainable and used when opening a window:title()
Set the window title.Window title text
url()
Set the window URL.Full URL to load in the window
route()
Set the window URL using a Laravel route name.Laravel route name
Route parameters
width()
Set the window width.Width in pixels
height()
Set the window height.Height in pixels
minWidth() / minHeight()
Set minimum dimensions for the window.Minimum width in pixels
Minimum height in pixels
maxWidth() / maxHeight()
Set maximum dimensions for the window.Maximum width in pixels
Maximum height in pixels
resizable()
Set whether the window can be resized.Whether window is resizable
movable()
Set whether the window can be moved.Whether window is movable
minimizable()
Set whether the window can be minimized.Whether window is minimizable
maximizable()
Set whether the window can be maximized.Whether window is maximizable
closable()
Set whether the window can be closed.Whether window is closable
focusable()
Set whether the window can receive focus.Whether window is focusable
alwaysOnTop()
Set whether the window stays on top of other windows.Whether window stays on top
skipTaskbar()
Set whether to hide the window from the taskbar.Whether to skip taskbar
hiddenInMissionControl()
Set whether to hide the window in macOS Mission Control.Whether to hide in Mission Control
hasShadow()
Set whether the window has a shadow.Whether window has shadow
Window Appearance
frameless()
Create a window without a frame.titleBarStyle()
Set the title bar style.Style: ‘default’, ‘hidden’, ‘hiddenInset’, ‘customButtonsOnHover’
titleBarHidden()
Hide the title bar.titleBarHiddenInset()
Hide the title bar with inset style.titleBarButtonsOnHover()
Show title bar buttons only on hover.trafficLightPosition()
Set the position of macOS traffic light buttons.X coordinate in pixels
Y coordinate in pixels
trafficLightsHidden()
Hide the macOS traffic light buttons.windowButtonVisibility()
Set the visibility of window buttons.Whether buttons are visible
backgroundColor()
Set the window background color.Hex color code (e.g., ‘#FFFFFF’)
transparent()
Make the window background transparent.Whether window is transparent
vibrancy()
Set the vibrancy effect (macOS).Vibrancy type: ‘appearance-based’, ‘light’, ‘dark’, ‘under-window’
lightVibrancy()
Apply light vibrancy effect.darkVibrancy()
Apply dark vibrancy effect.blendBackgroundBehindWindow()
Blend the content behind the window.invisibleFrameless()
Create an invisible frameless window (useful for overlays).Developer Tools
showDevTools()
Show developer tools in the window.Whether to show dev tools
hideDevTools()
Hide developer tools.devToolsOpen()
Check if developer tools are open.Returns true if dev tools are open
Fullscreen & Kiosk
fullscreen()
Set the window to fullscreen mode.Whether window is fullscreen
fullscreenable()
Set whether the window can enter fullscreen.Whether window can be fullscreen
kiosk()
Set the window to kiosk mode.Whether window is in kiosk mode
hideMenu()
Auto-hide the menu bar.Whether to auto-hide the menu bar
Advanced Options
rememberState()
Remember window size and position between sessions.zoomFactor()
Set the zoom level for the window content.Zoom factor (1.0 = 100%)
webPreferences()
Set Electron web preferences.Array of web preference options
preventLeaveDomain()
Prevent navigation outside the application domain.Whether to prevent leaving domain
preventLeavePage()
Prevent navigation away from the current page.Whether to prevent leaving page
suppressNewWindows()
Suppress opening of new windows.afterOpen()
Execute a callback after the window opens.Callback function to execute