Window API
The Window API provides everything you need to create and manage windows, including creating windows, resizing, setting themes, and more.
For WebView-related operations such as page navigation, script execution, DevTools, and printing, see WebView API.
For unified interception of web permission requests (camera, microphone, display capture, file access, etc.), see Web Permission API.
All of the following functions target a specific window_id (the integer returned when the window was created). Unless otherwise noted, success is usually 1 and failure is 0.
Creating Windows
Create a Normal Window
Creates a browser window with a system title bar and border, running a WebView inside it. This is the most common way to create a main window.
uint32_t create_webview_window(
const char* url,
uint32_t parent_window_id,
const WebViewWindowOptions* options,
const WebViewSettings* webview_settings
);Parameters:
urlstring- The URL or local protocol address to open firstparent_window_iduint32_t- Parent window;0means a top-level windowoptionsWebViewWindowOptions*(optional) - Window appearance configuration; passNULLto use defaultsWebViewWindowOptions options:
titlestring- The text shown in the window's title barwidthint32_t- Initial width (pixels)heightint32_t- Initial height (pixels)resizableint32_t- Whether the user can resize the window by dragging its edges with the mouseframe_stylestring- Whether to use a system border + title bar, border only without title bar, fully frameless, or frameless + a built-in title bar button overlay (normal/no-titlebar/borderless/title-overlay).title-overlayprovides a border + no title bar + built-in title bar buttons in the top-right corner, so you don't have to implement window control button functionality yourself (supported on both Windows and Linux; Linux gained this overlay in v2.3.0-beta.6)transparentint32_t- Whether to use a transparent background (depends on the WebView and system capabilities)background_colorstring- Window background color string (e.g. hexadecimal with a#)always_on_topint32_t- Whether to keep the window always on topthemestring- Light / Dark / follow system (Light,Dark,System)maximizedint32_t- Whether to start maximizedmaximizableint32_t- Whether the maximize button in the title bar is enabledminimizableint32_t- Whether the minimize button in the title bar is enabledxint32_t- X coordinate of the window's top-left corner; setting both to -1 lets the system center it for youyint32_t- Y coordinate of the window's top-left corner; setting both to -1 lets the system center it for youmin_widthint32_t- Minimum allowed width;0usually means no limitmin_heightint32_t- Minimum allowed height;0usually means no limitmax_widthint32_t- Maximum allowed width;0usually means no limitmax_heightint32_t- Maximum allowed height;0usually means no limitfullscreenint32_t- Whether to start in fullscreenfocusint32_t- Whether to grab keyboard focus after openinghide_windowint32_t- When non-zero, create the window but don't show it (good for loading first, then callingshow)use_page_iconint32_t- Whether to use the web page's favicon as the initial window icon (supported on both Windows and Linux; extracting the icon from the exe is Windows only)content_protectionint32_t- Whether to enable screen-recording/screenshot protection (Windows only; Linux/X11 has no system-level equivalent — the setting does not error but provides no actual protection)auto_save_stateint32_t- Non-0: records the window's last valid physical top-left coordinates bywindow_idinwindow_state.yamlunder the data directory; the next time a window is created with the samewindow_id, if that position still falls within the work area of some monitor, the position is restored (width, height, and maximized state still follow the parameters of this creation call). The state is debounced and written to disk roughly 450ms after the window stops moving, and is saved once more on closeskip_taskbarint32_t- Whether to keep the window out of the taskbar / Alt-Tab (0= no,1= yes). Added in v2.3.0-beta.6; appended at the end of the struct to keep field order compatible (useset_window_skip_taskbarat runtime, see "Window Flags & Level" below)no_activateint32_t- Whether to avoid stealing focus: neither clicking nor showing the window activates it (0= no,1= yes). Added in v2.3.0-beta.6; appended at the end of the struct to keep field order compatible (useset_window_no_activateat runtime, see "Window Flags & Level" below)
webview_settingsWebViewSettings*(optional) - Web page behavior configuration; passNULLto use defaultsWebViewSettings options:
autoplayint32_t- Whether media is allowed to autoplaybackground_throttlingint32_t- Whether to lower timer/animation frequency to save resources when the window is in the backgroundallow_right_clickint32_t- Whether to allow the web page's right-click menu.0= disabled,1= allowed; unset (or passingNULLfor the wholewebview_settings) defaults to alloweduastring- Custom User-Agentpreload_jsstring- A snippet of JS to inject before the page loadsallow_fullscreenint32_t- Whether the fullscreen API is allowed within the web pagepostmessage_whiteliststring- A whitelist that determines whether the page'spostMessagecalls are forwarded to the main process, given as a single UTF-8 string (usually close to the page'sorigin, e.g.https://example.com). When matching, the library passes ifevent.originequals the string, or if theoriginhas the string as a suffix. If the pointer isNULL/unset: under the current implementation, no origin is allowed through (i.e. you won't receivepostmessage-received). Built-in static pages loaded viaset_protocol_service_pathskip the whitelist in the implementation and are always able to receivecors_whiteliststring- Supported in v2.1+. CORS origin whitelist, a comma- or semicolon-separated list of domains (e.g."http://198.18.0.1:8001, http://localhost:3000").- Strict exact matching; wildcards are not supported. Once set, only origins in the whitelist may make cross-origin requests to JadeView's internal APIs (invoke, on); if unset (
NULL) or an empty string, no cross-origin requests are allowed and communication with the program is impossible.WARNINGThe following structures are supported starting from v2.2
- Strict exact matching; wildcards are not supported. Once set, only origins in the whitelist may make cross-origin requests to JadeView's internal APIs (invoke, on); if unset (
autofillint32_t- Whether to enable account/password autofill.0= disabled,1= enabled.general_autofill_enabledint32_t- Whether to enable general form autofill (name/address/phone, etc.).0= disabled,1= enabled.incognitoint32_t- Whether to run in incognito/private browsing mode.0= normal mode,1= incognito mode. Page rendering becomes slower when enabled.disable_clipboardint32_t- Whether to disable clipboard read/write permissions.0= allowed,1= disabled.proxy_urlstring- Proxy URL; supports HTTP and SOCKS5 proxies (e.g."http://127.0.0.1:7890"or"socks5://127.0.0.1:1080").NULLmeans no proxy is used.focusedint32_t- Whether the WebView automatically gains focus initially.0= does not gain focus,1= autofocus (default1).profile_namestring- Added in v2.4, appended at the end of the struct.NULLor an empty string uses the default profile, matching 2.3.x behavior; a non-empty string uses a named WebView2 profile to isolate cookies, LocalStorage, IndexedDB, and cache (currently Windows-only; Linux accepts the field but ignores it). The name must be at most 64 characters, contain only letters, digits,.,_,-, or spaces, and must not start or end with.or a space; invalid names fall back to the default profile.
Return value:
> 0- The window id; the window may actually be drawn slightly later, which you can pair with events such aswindow-created0- Failure, for example calling it beforeapp-ready
2.0 removed the old remove_titlebar, borderless, no_center and other fields. You must use frame_style and x/y=-1 for centering, otherwise the struct will mismatch and silently misposition.
Create a Frameless Window
Creates a WebView window with no system title bar, suitable for scenarios such as custom-drawn title bars or floating tool windows. The frame style is fixed to frameless.
uint32_t create_borderless_webview_window(
const char* url,
const WebViewSettings* webview_settings
);Parameters:
urlstring- The URL or local protocol address to open firstwebview_settingsWebViewSettings*(optional) - Web page behavior configuration; passNULLto use defaults
Return value:
A non-0 return is the window_id. Use this id for navigation, IPC, and executing JS, just like with a normal window.
Get Window Handle
When working in C/C++, an HWND is required to pass a window to other Win32 APIs (such as SetWindowPos or child control attachment).
Note: Prior to version 2.3, only windows created via create_borderless_webview_window return a valid handle value. Regular windows created with create_webview_window always return 0.
size_t get_window_hwnd(uint32_t window_id);Parameters:
window_iduint32_t– Target window ID
Get Window ID (v2.3) v2.3
Retrieve the Jadeview window ID from its window handle
uint32_t get_window_id(int32_t hwnd);Parameters:
hwndint32_t– Target window handle
Position, Size, and Title
Set the Window Title
Changes the text shown in the window's title bar (which can differ from the <title> in the HTML).
int32_t set_window_title(uint32_t window_id, const char* title);Parameters:
window_iduint32_t- Target window idtitlestring- The new window title
Set the Window Size
Changes the window's width and height in pixels.
int32_t set_window_size(uint32_t window_id, int32_t width, int32_t height);Parameters:
window_iduint32_t- Target window idwidthint32_t- The new width (pixels)heightint32_t- The new height (pixels)
Set the Window Position
Changes the window's position on the screen in pixels.
int32_t set_window_position(uint32_t window_id, int32_t x, int32_t y);Parameters:
window_iduint32_t- Target window idxint32_t- The new X coordinateyint32_t- The new Y coordinate
Get Window Position and Size (get_window_bounds) v2.2
int32_t get_window_bounds(uint32_t window_id, char* buffer, int buffer_size);Parameters:
window_iduint32_t- Target window idbufferchar*- Output bufferbuffer_sizeint- Buffer size
Return value: 1 = success, with the buffer written as JSON {"x":0,"y":0,"width":800,"height":600}; 0 = failure
Visibility and Focus
Show or Hide the Window
Shows or hides the window (visibility changes other than minimizing).
int32_t set_window_visible(uint32_t window_id, int32_t visible);Parameters:
window_iduint32_t- Target window idvisibleint32_t- Non-0shows,0hides
Give the Window Focus
Gives the window keyboard focus.
int32_t set_window_focus(uint32_t window_id);Parameters:
window_iduint32_t- Target window id
Set the Window Always on Top
Whether to keep the window on top so it isn't covered by other normal windows.
int32_t set_window_always_on_top(uint32_t window_id, int32_t always_on_top);Parameters:
window_iduint32_t- Target window idalways_on_topint32_t- Non-0pins it on top,0unpins it
Set Ignore Cursor Events (set_window_ignore_cursor_events) v2.2
Sets whether the window ignores mouse events (mouse pass-through), suitable for floating window / overlay scenarios.
int32_t set_window_ignore_cursor_events(uint32_t window_id, int ignore);- Parameters:
window_id,ignore(1= ignore mouse events / pass-through,0= normal) - Return value:
1= success,0= failure
Window Flags & Level v2.3.0-beta.6
For scenarios such as side docks, floating panels, desktop widgets, and launchers: keep the window out of the taskbar / Alt-Tab, avoid stealing focus while it stays resident, or push the window down to the desktop wallpaper layer.
Skip the Taskbar / Alt-Tab (set_window_skip_taskbar)
Hides the window from the taskbar and the Alt-Tab switcher; commonly used for floating tool windows and widgets. You can also set it at creation time via WebViewWindowOptions.skip_taskbar.
int32_t set_window_skip_taskbar(uint32_t window_id, int32_t skip);- Parameters:
window_id;skip(1= skip the taskbar / Alt-Tab,0= restore) - Return value:
1= success,0= failure
Windows: adds WS_EX_TOOLWINDOW and removes WS_EX_APPWINDOW; Linux: GTK skip-taskbar-hint.
Do Not Steal Focus (set_window_no_activate)
Keeps the window from gaining activation focus when clicked or shown, suitable for resident floating panels (clicking it won't interrupt your typing elsewhere). You can also set it at creation time via WebViewWindowOptions.no_activate.
int32_t set_window_no_activate(uint32_t window_id, int32_t no_activate);- Parameters:
window_id;no_activate(1= do not steal focus,0= restore) - Return value:
1= success,0= failure
Windows: WS_EX_NOACTIVATE (SetWindowLongPtr); Linux: GTK accept-focus=false.
Set the Window Level (set_window_level)
Sets which layer the window sits on in one call — more flexible than plain "always on top": you can push the window below all others, or even pin it to the desktop wallpaper layer as a widget.
// level: "topmost" | "normal" | "bottom" | "desktop"
int32_t set_window_level(uint32_t window_id, const char* level);- Parameters:
window_id;levelstring- the level string; see the table below - Return value:
1= success,0= failure
| level | Behavior | Implementation |
|---|---|---|
topmost | On top, above normal windows | set_always_on_top(true) (cross-platform) |
normal | Normal layer; cancels topmost / bottom | Clears always-on-top / always-on-bottom |
bottom | Below other windows | set_always_on_bottom(true) (cross-platform) |
desktop | Pinned to the desktop wallpaper layer (only visible after minimizing all windows; widget-like) | First bottom; on Windows parents to Progman / WorkerW, on Linux sets GTK WindowTypeHint::Desktop |
topmost / normal / bottom are stable cross-platform; desktop (wallpaper layer) is best-effort, depends on window manager behavior, and is recommended to be verified on a real machine. If parenting fails, it at least degrades to bottom (still below all windows).
Window State
Minimize the Window
Sends the window to the taskbar.
int32_t minimize_window(uint32_t window_id);Parameters:
window_iduint32_t- Target window id
Toggle the Maximized State
Toggles between maximized and restored.
int32_t toggle_maximize_window(uint32_t window_id);Parameters:
window_iduint32_t- Target window id
Query Whether Maximized
Queries whether the window is currently maximized.
int32_t is_window_maximized(uint32_t window_id);Parameters:
window_iduint32_t- Target window id
Return value:
1- Currently maximized0- Currently not maximized
Set Fullscreen
Enters or exits fullscreen (filling the monitor, not just maximizing). The request takes effect asynchronously; you can also listen for the window-fullscreen event.
int32_t set_window_fullscreen(uint32_t window_id, int32_t fullscreen);Parameters:
window_iduint32_t- Target window idfullscreenint32_t- Non-0enters fullscreen,0exits fullscreen
Query Whether the Window Is Minimized (is_window_minimized) v2.2
int32_t is_window_minimized(uint32_t window_id);- Parameters:
window_iduint32_t - Return value:
1= minimized,0= not
Query Whether the Window Is Visible (is_window_visible) v2.2
int32_t is_window_visible(uint32_t window_id);- Parameters:
window_iduint32_t - Return value:
1= visible,0= not visible
Query Whether the Window Is Focused (is_window_focused) v2.2
int32_t is_window_focused(uint32_t window_id);- Parameters:
window_iduint32_t - Return value:
1= focused,0= not
Query Whether the Window Is Fullscreen (is_window_fullscreen) v2.2
int32_t is_window_fullscreen(uint32_t window_id);- Parameters:
window_iduint32_t - Return value:
1= fullscreen,0= not
Window Constraints
Set the Window Minimum Size (set_window_min_size) v2.2
int32_t set_window_min_size(uint32_t window_id, int32_t width, int32_t height);- Parameters:
window_id,width(minimum width),height(minimum height) - Return value:
1= success,0= failure
Set the Window Maximum Size (set_window_max_size) v2.2
int32_t set_window_max_size(uint32_t window_id, int32_t width, int32_t height);- Parameters:
window_id,width(maximum width),height(maximum height) - Return value:
1= success,0= failure
Set Whether the Window Is Resizable (set_window_resizable) v2.2
int32_t set_window_resizable(uint32_t window_id, int32_t resizable);- Parameters:
window_id,resizable(1= resizable,0= not) - Return value:
1= success,0= failure
Enable or Disable the Window
When a window is disabled, the user cannot click the controls on it (like the grayed-out window behind a modal dialog); pass non-0 to restore it.
int32_t set_window_enabled(uint32_t window_id, int32_t enabled);Parameters:
window_iduint32_t- Target window idenabledint32_t- Non-0enables,0disables
Appearance and Style
Change the Window Frame Style at Runtime
Dynamically changes the window's frame style without recreating the window.
int32_t set_window_frame_style(uint32_t window_id, const char* frame_style);Parameters:
window_iduint32_t- Target window idframe_stylestring- Frame style string; available values:normal(border + title bar),no-titlebar(border + no title bar),borderless(no border + no title bar),title-overlay(border + no title bar + built-in title bar buttons)
Customize the Title Bar Overlay Style (set_titlebar_overlay_style)
Customizes the appearance (height / icon color / hover background) of the title bar button overlay for title-overlay style windows.
int32_t set_titlebar_overlay_style(
uint32_t window_id,
int32_t height,
const char* icon_color_hex,
const char* hover_bg_hex
);Parameters:
window_iduint32_t- Target window idheightint32_t- Button height (pixels); pass0or a negative number to keep the current height unchanged; the overlay's initial default height is 32. Button width is fixed at 46 pixelsicon_color_hexstring(optional) - Icon color, in the format#RRGGBB(e.g."#FFFFFF"); passNULLto use the default colorhover_bg_hexstring(optional) - Hover background color for non-close buttons, in the format#RRGGBBor#RRGGBBAA(alpha supported, e.g."#00000080"); passNULLto use the default dark gray
The close button's hover background color is fixed to red (#E81123) and its icon is fixed to white, unaffected by this API.
Runtime style customization via this function currently takes effect on Windows only. On Linux the title-overlay overlay still renders, but uses the built-in default style (icon #1E1E1E, hover background #DCDCDCBF, height 32) and is not yet customizable via this function.
Set the Window Light/Dark Theme
Controls whether the window and WebView use the light theme, dark theme, or follow the system theme.
For more detailed information, see Theme Management.
int32_t set_window_theme(uint32_t window_id, const char* theme);Parameters:
window_iduint32_t- Target window idthemestring- Theme string; available values:Light,Dark,System
Get the Current Window Theme
Queries the theme currently used by the window.
int32_t get_window_theme(uint32_t window_id);Parameters:
window_iduint32_t- Target window id
Return value:
1- Dark0- Light
The System theme is resolved to 1 / 0 based on the current system light/dark setting; returns 0 if the window does not exist or the theme is unknown.
Set the Window Backdrop Material
Sets system backdrop materials such as Mica and Acrylic on Windows 11.
For available strings, see Theme Management.
int32_t set_window_backdrop(uint32_t window_id, const char* backdrop_type);Parameters:
window_iduint32_t- Target window idbackdrop_typestring- Backdrop material type
Windows 11 only. Linux (WebKitGTK) has no system material equivalent — the call is a no-op, returns 0, and has no visual effect. If you need a translucent / solid background, use set_window_background_color or the window's transparent + background_color options.
Set the Window Background Color
Sets the window's background color (hexadecimal string).
int32_t set_window_background_color(uint32_t window_id, const char* background_color_hex);Parameters:
window_iduint32_t- Target window idbackground_color_hexstring- Background color hexadecimal string, e.g.#FF0000
Request a Redraw
Notifies the system to repaint the client area (rarely needs to be called manually).
int32_t request_redraw(uint32_t window_id);Parameters:
window_iduint32_t- Target window id
Taskbar Effects
Set the Taskbar Progress Bar (set_window_progress) v2.2
Displays a progress bar on the taskbar button (e.g. download progress, install progress, etc.).
int32_t set_window_progress(uint32_t window_id, int progress, int state);- Parameters:
window_iduint32_tprogressint- Progress value (0–100)stateint- State:0=no progress,1=normal,2=paused (yellow),3=error (red),4=indeterminate
- Return value:
1= success,0= failure
Windows platform only.
Flash the Taskbar Icon (flash_window) v2.2
Flashes the taskbar icon to attract the user's attention (e.g. when a message arrives).
int32_t flash_window(uint32_t window_id, uint32_t count);- Parameters:
window_iduint32_t;countuint32_t- Number of flashes,0= stop flashing - Return value:
1= success,0= failure
Windows platform only.
Closing and Counting
Close the Window
Initiates closing; if the page registered a beforeunload handler and the user chooses to stay, closing may be deferred or canceled, depending on the WebView and the page script.
int32_t close_window(uint32_t window_id);Parameters:
window_iduint32_t- Target window id
Get the Window Count
Queries how many windows are still open in the current JadeView.
uint32_t get_window_count(void);