proton

MoonBit bindings for the Proton native desktop runtime.

proton
gui
web
desktop-app
Download zip
Version
0.2.4
License
Apache-2.0
Last updated
2 hours ago
Downloads
2K

#moonbit-community/proton

MoonBit facade for building Proton desktop applications on the native runtime. This package is the public app surface: windows, entries, commands, events, and lifecycle hooks are all configured from MoonBit code. For the full development workflow — scaffolding, CEF runtime setup, dev mode, and packaging — see the repository README and the proton_cli tool.

#Quick example

async fn main {
@proton.html("Hello", "<h1>Hello</h1>")
.identifier("dev.proton.hello")
.run_or_abort()
}

main is async because Proton hands its own event loop to moonbitlang/async during process initialization; from then on every line of MoonBit runs on the main thread and only async's waiting half moves to a thread of its own. Nothing has to be installed by hand, but the package must import moonbitlang/async for async fn main to be available at all. @proton.html accepts optional width?, height?, debug?, and resizable? arguments.

Every application requires a stable reverse-DNS identity. Managed projects use .load_config() to load it from proton.project.json during development and from packaged metadata after distribution. Applications without project metadata use .identifier(...) as shown above. These sources are mutually exclusive, and an explicit identity must match any packaged metadata present at runtime.

#Application metadata and paths

Managed applications expose the package product_name and version through App::name and App::version. Development runs read proton.project.json; packaged runs read the sanitized proton-package.json generated by proton_cli package. Missing package metadata is reported explicitly instead of falling back to the window title or Proton library version.

@proton.app_path() returns the application resource root and @proton.is_packaged() distinguishes packaged execution. App::path accepts a typed AppPathKind for home, application data, user data, browser session data, temporary files, the executable/module, logs, and configured desktop, documents, downloads, music, pictures, and videos directories. Assets is available on Windows and Linux, and Recent is available on Windows. Persistent application paths use the reverse-DNS identifier, so changing a display name does not move user state.

App::set_path overrides any supported standard path before startup and requires an existing absolute path. App::set_app_logs_path accepts an absolute directory that Proton creates during startup; omitting the path selects Electron's default logs location. UserData overrides feed the default SessionData path, while an explicit SessionData override becomes the CEF browser profile location for single-instance applications.

#Protocol and process control

Declare application URL schemes with App::url_scheme. A running ApplicationContext can then set, remove, or query the current application as the default handler with set_as_default_protocol_client, remove_default_protocol_client, and is_default_protocol_client. macOS requires the packaged CFBundleURLTypes declaration; Linux requires the generated desktop entry to be installed. Electron does not expose protocol removal on Linux, so Proton returns false there as well.

ApplicationContext::relaunch schedules a replacement process without stopping the current one. With no options it preserves the current command line; RelaunchOptions can replace the executable or arguments. Call quit for orderly shutdown or exit for immediate Electron-style termination that skips close interception and lifecycle cleanup. Scheduled relaunches are started after orderly cleanup or immediately before exit terminates the process.

#Entry points

  • @proton.html(title, html, ...) — inline HTML document.
  • @proton.url(title, url, ...) — a remote or local URL.
  • @proton.file(title, path, ...) — an HTML file on disk.
  • @proton.asset(title, path, ...) — an HTML asset shipped with the app.

#Commands and events

Register typed commands on the app builder:

@proton.html("Commands", html)
.identifier("dev.proton.commands")
.commands(fn(registrar) raise { registrar.bind(ping_command, ping) })
.run_or_abort()

Application commands target the primary configured entry by default. Pass targets to .commands(...) when a different renderer needs them. Extension packages expose typed values consumed by .capability(...).

@proton.CommandRegistrar binds contract command descriptors to async handlers; each handler receives a @proton.CommandContext and the decoded request payload. The backend emits events to the renderer with CommandContext::emit(event, payload). JavaScript invokes commands and subscribes to events through the bridge installed on window: commands are called by their contract operation name through core.invokeOp, and backend events arrive on the events channel. For a contract with namespace app:

const reply = await window.__MoonBit__.core.invokeOp("ext:app/ping", { name: "proton", }); window.__MoonBit__.events.on("app.tick", (event) => console.log(event.payload));

Extensions built on moonbit-community/proton_ext additionally install namespaced proxies such as window.__MoonBit__.ticker.start(...).

#Windows

Add secondary windows to the app builder:

@proton.html("Main", main_html)
.add_window(
"settings",
"Settings",
@proton.AppEntry::Html(settings_html),
width=420,
height=320,
)

The window id "main" is reserved for the primary window. By default, the process exits when all windows have closed. Use .last_window_closed_policy(@proton.LastWindowClosedPolicy::KeepRunning) when the application should remain available for Dock, protocol, document, or tray activation after its last window closes.

Live window handles can change native frame behavior after creation. In particular, WindowHandle::set_movable(false) blocks manual movement on macOS and Windows while preserving programmatic placement; Linux follows Electron's successful no-op behavior. WindowHandle::set_opacity adjusts the complete native window, including its frame and renderer, with values clamped to 0.0..1.0. WindowHandle::set_skip_taskbar controls the Windows taskbar tab while preserving Electron's no-op behavior on macOS and Linux. WindowHandle::set_aspect_ratio constrains interactive resizing and accepts 0.0 to clear the constraint; programmatic set_size calls remain unconstrained, matching Electron. WindowHandle::set_content_size adjusts the renderer area while accounting for the native frame. content_size reads that area back in logical pixels. set_menu replaces or clears the runtime menu, set_icon loads a native icon from a file path, and set_parent establishes a native owner/transient or modal relationship. set_window_button_visibility controls standard title-bar buttons on macOS and is a successful no-op on other platforms. Web contents views expose independent set_zoom_percent and zoom_percent controls for their own browser.

#Logging

Use tonyfettes/xlog@0.4.1 directly for application logs. Proton configures the global logger before native runtime creation. Packaged applications write to their platform log directory; direct launches and proton_cli dev use stderr. MOON_XLOG controls filtering and PROTON_LOG_OUTPUT selects file or stderr; file output requires packaged application metadata. Application categories should use app.*; proton.* is reserved for framework diagnostics.

#Headless mode

.headless() runs the app off-screen without creating a native window. Set PROTON_HEADLESS=1 to force headless mode for automated test runs.

Native dialogs, menus, title bars, and other window-bound UI are unavailable in headless mode. In particular, open, save, and directory dialogs fail with an unsupported-operation error instead of displaying unparented system UI.

#Application locale

App::locale selects an immutable application locale before native runtime creation. The resolved locale and preferred language order are available from application, window, and command contexts and are also supplied to CEF. Applications own their translation catalogs and localized content; Proton only owns platform discovery, propagation, standard native menu labels, and its framework failure shell.

#Learn more

  • Runnable demos live in the repository's examples/ directory.
  • The CLI covers the project workflow: proton_cli new, proton_cli cef setup, proton_cli dev, proton_cli build, and proton_cli package.

AppEntry

Declarative entry content loaded into a Proton application window.

CommandContext

Request-scoped context supplied to typed application command handlers.

Lifecycle-owned task and event capabilities are added by the application runner; the registrar keeps handlers independent from transport details.

CommandRegistrar

Startup-only capability for binding typed command descriptors to handlers.

CommandWindow

Window-scoped application capabilities available to one command request. The native window identity and implementation remain owned by the Proton runtime; extensions can only invoke these semantic operations.

Locale

A canonical RFC 5646 language tag.

LocaleParseError

Failures produced while parsing an RFC 5646 language tag.

PermissionScopeValidationError

A stable validation failure for an extension's renderer permission scope.

AppCleanupError

pub(all) suberror AppCleanupError {
CommandExtension(CommandExtensionLifecycleError)
LifecycleHook(LifecycleHookError)
WindowDestroy(status~ : Int, detail~ : String)
RuntimeDestroy(status~ : Int, detail~ : String)
} derive(
Debug
)

A failure from one stage of best-effort application teardown.

AppCleanupError::message

fn AppCleanupError::message(self : AppCleanupError) -> String

AppCleanupError::output

fn AppCleanupError::output(self : AppCleanupError, logger : &Logger) -> Unit

AppCleanupError::to_string

fn AppCleanupError::to_string(self : AppCleanupError) -> String

AppConfigurationError

pub(all) suberror AppConfigurationError {
InvalidSetting(name~ : String, message~ : String)
ExtensionDependencyCycle(extension_id~ : String)
ExtensionUnavailable(extension_id~ : String, requested_by~ : String?, state~ : String)
ExtensionAdaptationFailed(extension_id~ : String, error~ :
ExtensionAdapterError
)
InvalidJavaScriptNamespace(js_namespace~ : String)
InvalidJavaScriptApi(js_namespace~ : String, api_name~ : String)
InvalidEntryUrl(url~ : String, reason~ : String)
InvalidRendererCapability(detail~ : String)
} derive(
Debug
)

Failures while resolving and validating an application's configuration.

AppConfigurationError::message

fn AppConfigurationError::message(self : AppConfigurationError) -> String

AppConfigurationError::output

fn AppConfigurationError::output(self : AppConfigurationError, logger : &Logger) -> Unit

AppConfigurationError::to_string

fn AppConfigurationError::to_string(self : AppConfigurationError) -> String

AppControlError

pub(all) suberror AppControlError {
InvalidProtocolScheme(scheme~ : String)
UndeclaredProtocolScheme(scheme~ : String)
InvalidExecutable(path~ : String)
NativeControlFailure(action~ : String, status~ : Int, detail~ : String)
} derive(Eq,
Debug
)

Failures from application-level desktop and process controls.

AppControlError::equal

AppControlError::message

fn AppControlError::message(self : AppControlError) -> String

AppControlError::not_equal

fn AppControlError::not_equal(x : AppControlError, y : AppControlError) -> Bool

AppControlError::output

fn AppControlError::output(self : AppControlError, logger : &Logger) -> Unit

AppControlError::to_string

fn AppControlError::to_string(self : AppControlError) -> String

AppEntryError

pub(all) suberror AppEntryError {
ReadFailed(path~ : String, detail~ : String)
PlatformLoad(action~ : String, status~ : Int, detail~ : String)
ClosedDuringStartup
} derive(
Debug
)

Failures while loading the application's initial document.

AppEntryError::message

fn AppEntryError::message(self : AppEntryError) -> String

AppEntryError::output

fn AppEntryError::output(self : AppEntryError, logger : &Logger) -> Unit

AppEntryError::to_string

fn AppEntryError::to_string(self : AppEntryError) -> String

AppMetadataError

pub(all) suberror AppMetadataError {
MissingPackageMetadata
MissingField(field~ : String)
InvalidMetadata(detail~ : String)
} derive(Eq,
Debug
)

Failures while reading application metadata managed by Proton tooling.

AppMetadataError::equal

AppMetadataError::message

fn AppMetadataError::message(self : AppMetadataError) -> String

AppMetadataError::not_equal

fn AppMetadataError::not_equal(x : AppMetadataError, y : AppMetadataError) -> Bool

AppMetadataError::output

fn AppMetadataError::output(self : AppMetadataError, logger : &Logger) -> Unit

AppMetadataError::to_string

fn AppMetadataError::to_string(self : AppMetadataError) -> String

AppPathError

pub(all) suberror AppPathError {
MissingApplicationIdentifier
InvalidIdentifier(identifier~ : String)
MissingHomeDirectory(platform~ : String)
MissingEnvironmentPath(name~ : String, platform~ : String)
MissingExecutablePath
UnsupportedPath(kind~ : String, platform~ : String)
InvalidPathOverride(kind~ : String, path~ : String, reason~ : String)
SystemPath(kind~ : String, status~ : Int, detail~ : String)
PlatformProbe(status~ : Int, detail~ : String)
} derive(Eq,
Debug
)

Failures while resolving framework-owned application paths.

AppPathError::equal

AppPathError::message

fn AppPathError::message(self : AppPathError) -> String

AppPathError::not_equal

fn AppPathError::not_equal(x : AppPathError, y : AppPathError) -> Bool

AppRunError

pub(all) suberror AppRunError {
EventLoopError(String)
ConfigurationError(AppConfigurationError)
LoggingInitializationFailed(detail~ : String)
UnsupportedNativeFeature(feature~ : String)
RuntimeOperationFailed(action~ : String, status~ : Int, detail~ : String)
CommandExtensionLifecycleError(CommandExtensionLifecycleError)
LifecycleHookError(LifecycleHookError)
EntryLoadError(AppEntryError)
BridgeStartupError(BridgeDiagnostic)
BridgeRuntimeError(BridgeDiagnostic)
CleanupFailed(primary~ : String?, failures~ : Array[AppCleanupError])
UnexpectedTaskFailure(detail~ : String)
} derive(
Debug
)

Failures produced while configuring, starting, or running an application.

AppRunError::message

fn AppRunError::message(self : AppRunError) -> String

AppRunError::output

fn AppRunError::output(self : AppRunError, logger : &Logger) -> Unit

AppRunError::to_string

fn AppRunError::to_string(self : AppRunError) -> String

CommandExtensionLifecycleError

pub(all) suberror CommandExtensionLifecycleError {
ApplicationRegistrationFailed(detail~ : String)
RegistrationFailed(extension_id~ : String, detail~ : String)
EventSourceStartFailed(extension_id~ : String, detail~ : String)
DestroyFailed(extension_id~ : String, detail~ : String)
} derive(
Debug
)

Failures while starting or stopping command extensions.

CommandExtensionLifecycleError::message

CommandExtensionLifecycleError::output

CommandExtensionLifecycleError::to_string

LifecycleHookError

pub(all) suberror LifecycleHookError {
ApplicationStart(index~ : Int, detail~ : String)
ApplicationShutdown(index~ : Int, detail~ : String)
WindowReady(index~ : Int, detail~ : String)
WindowClose(index~ : Int, detail~ : String)
} derive(
Debug
)

Failures produced by application or window lifecycle hooks.

LifecycleHookError::message

fn LifecycleHookError::message(self : LifecycleHookError) -> String

LifecycleHookError::output

fn LifecycleHookError::output(self : LifecycleHookError, logger : &Logger) -> Unit

LifecycleHookError::to_string

fn LifecycleHookError::to_string(self : LifecycleHookError) -> String

NotificationDeliveryError

pub(all) suberror NotificationDeliveryError {
NativeFailure(status~ : Int, detail~ : String)
WaitInterrupted(detail~ : String)
DeliveryFailed(message~ : String)
} derive(Eq,
Debug
)

Failures while starting or waiting for native notification delivery.

NotificationDeliveryError::equal

NotificationDeliveryError::message

NotificationDeliveryError::not_equal

ScreenQueryError

pub(all) suberror ScreenQueryError {
QueryFailed(status~ : Int, detail~ : String)
} derive(
Debug
)

Failures while querying connected displays.

ScreenQueryError::message

fn ScreenQueryError::message(self : ScreenQueryError) -> String

ScreenQueryError::output

fn ScreenQueryError::output(self : ScreenQueryError, logger : &Logger) -> Unit

ScreenQueryError::to_string

fn ScreenQueryError::to_string(self : ScreenQueryError) -> String

SystemLocaleError

pub(all) suberror SystemLocaleError {
NativeQuery(status~ : Int, detail~ : String)
} derive(
Debug
)

Failures produced while querying the operating system's language order.

SystemLocaleError::message

fn SystemLocaleError::message(self : SystemLocaleError) -> String

SystemLocaleError::output

fn SystemLocaleError::output(self : SystemLocaleError, logger : &Logger) -> Unit

SystemLocaleError::to_string

fn SystemLocaleError::to_string(self : SystemLocaleError) -> String

WindowSessionError

pub(all) suberror WindowSessionError {
UnknownWindow(id~ : String)
AlreadyOpen(id~ : String)
ApplicationQuitting
StaleWindow(id~ : String)
UnknownView(id~ : String)
AlreadyExists(id~ : String)
StaleView(id~ : String)
Cancelled
OperationFailed(action~ : String, status~ : Int, detail~ : String)
StartupFailed(id~ : String, error~ : AppRunError)
} derive(
Debug
)

Failures from runtime window lookup, creation, or control.

WindowSessionError::message

fn WindowSessionError::message(self : WindowSessionError) -> String

WindowSessionError::output

fn WindowSessionError::output(self : WindowSessionError, logger : &Logger) -> Unit

WindowSessionError::to_string

fn WindowSessionError::to_string(self : WindowSessionError) -> String

App

type App

High-level application facade for ordinary Proton apps.

App::add_window

fn App::add_window(self : App, id : String, title : String, entry :
AppEntry
, width? : Int, height? : Int, size_hint? : WindowSizeHint, titlebar_style? : TitlebarStyle, open_on_start? : Bool) -> App

Adds a secondary window owned by the standard application lifecycle.

App::app_lifecycle

fn[State] App::app_lifecycle(self : App, on_start~ : async (ApplicationContext) -> State, on_shutdown~ : async (State) -> Unit) -> App

Adds a paired application lifecycle hook.

The startup state is passed to shutdown. Completed hooks shut down in reverse order, including when a later startup hook fails.

App::bridge_startup_timeout_ms

fn App::bridge_startup_timeout_ms(self : App, timeout_ms : Int) -> App

Sets the maximum time allowed for the native bridge to become ready.

App::capability

Grants one typed extension capability to its renderer targets.

The default target is the configured entry of the primary window. The capability registers its backend handlers and exposes only its validated scope to those renderers.

App::commands

fn App::commands(self : App, register : (
CommandRegistrar
) -> Unit raise, targets? : Array[RendererTarget]) -> App

Adds one package registrar for typed application commands.

Registration runs before any window is created and is sealed before the renderer bridge starts accepting requests. Only the operations registered by this callback are granted to its targets; the primary configured entry is the default target.

App::data_dir

fn App::data_dir(self : App) -> String raise AppPathError

Resolves the stable directory for this application's persistent native data. This function resolves the path but does not create the directory.

App::debug

fn App::debug(self : App, enabled? : Bool) -> App

Enables or disables runtime debug mode.

App::debug_level

fn App::debug_level(self : App, debug : Int) -> App

Sets the runtime debug level.

App::document_extension

fn App::document_extension(self : App, extension : String) -> App

Registers a document extension for single-instance launch forwarding. OS registration belongs to the package configuration.

App::entry_asset

fn App::entry_asset(self : App, path : String) -> App

Overrides the primary app entry with an asset path.

App::entry_file

fn App::entry_file(self : App, path : String) -> App

Overrides the primary app entry with a file path.

App::entry_html

fn App::entry_html(self : App, html : String) -> App

Overrides the primary app entry with inline HTML.

App::entry_url

fn App::entry_url(self : App, url : String) -> App

Overrides the primary app entry with a URL.

App::headless

fn App::headless(self : App, enabled? : Bool) -> App

Enables or disables off-screen headless rendering for the application.

Headless mode does not create a native top-level window, so native dialogs, menus, title bars, and other window-bound UI are unavailable. Set PROTON_HEADLESS=1 to force this mode for automated test runs.

App::identifier

fn App::identifier(self : App, identifier : String) -> App

Sets the canonical identifier for an application without project metadata.

App::last_window_closed_policy

fn App::last_window_closed_policy(self : App, policy : LastWindowClosedPolicy) -> App

Chooses whether closing the last window exits the application or leaves it running so a later launch input can open another window.

App::load_config

fn App::load_config(self : App) -> App

Loads this application's identifier from managed Proton metadata.

Development runs read proton.project.json. Packaged applications read the sanitized proton-package.json staged beside the executable.

App::locale

Selects the immutable locale used by this application runtime.

App::menu

fn App::menu(self : App, menu : MenuBar) -> App

Sets the app-level native menu bar.

App::name

fn App::name(self : App) -> String raise AppMetadataError

Returns the product name from managed development or packaged metadata.

App::on_browser_event

fn App::on_browser_event(self : App, handler : async (BrowserHandle, BrowserEvent) -> Unit noraise) -> App

Observes events for every main browser page: loading changes, main-frame navigations, title updates, load failures, and page-search results.

App::on_certificate_error

fn App::on_certificate_error(self : App, handler : async (BrowserHandle, CertificateError) -> BrowserPermissionDecision noraise) -> App

Reviews invalid TLS certificates. The default is denial.

App::on_download_event

fn App::on_download_event(self : App, handler : async (BrowserHandle, DownloadEvent) -> Unit noraise) -> App

Observes download progress and terminal states.

App::on_download_request

fn App::on_download_request(self : App, handler : async (BrowserHandle, DownloadRequest) -> DownloadDecision noraise) -> App

Reviews downloads before CEF chooses a destination.

App::on_launch_input

fn App::on_launch_input(self : App, handler : async (ApplicationContext, RuntimeLaunchInput) -> Unit noraise) -> App

App::on_media_permission_request

fn App::on_media_permission_request(self : App, handler : async (BrowserHandle, MediaPermissionRequest) -> BrowserPermissionDecision noraise) -> App

Reviews camera, microphone, and display-capture requests. The default is denial.

App::on_navigation_request

fn App::on_navigation_request(self : App, handler : async (BrowserHandle, NavigationRequest) -> NavigationDecision noraise) -> App

Reviews top-level navigations asynchronously. The native browser cancels a pending navigation until this handler returns, then replays it exactly once when allowed.

App::on_popup_request

fn App::on_popup_request(self : App, handler : async (BrowserHandle, PopupRequest) -> PopupDecision noraise) -> App

Reviews window.open and new-tab requests. New Proton windows must already be declared with add_window(..., open_on_start=false).

App::on_update_available

fn App::on_update_available(self : App, handler : async (PendingUpdate) -> Unit noraise) -> App

Registers an application-level handler for URL, file, and reopen inputs. Registers a handler for an update the channel offers.

Registering one is what turns the automatic check on: an application that has not said what to do when an update exists is not asked to contact a server on launch. The handler runs after the application is up, on the application task group, and never on the startup path.

It is called with an update that has already been authenticated and found newer. Nothing has been downloaded and nothing will be until the handler asks for it.

App::on_view_event

fn App::on_view_event(self : App, handler : async (ViewHandle, ViewEvent) -> Unit noraise) -> App

Observes events for every running web contents view: loading changes, main-frame navigations, title updates, load failures, page-search results, and close.

App::on_window_close_request

fn App::on_window_close_request(self : App, handler : async (WindowHandle) -> WindowCloseDecision noraise) -> App

Intercepts user-initiated close requests without blocking the native UI thread. WindowHandle::close uses the same request path; forced cleanup is reserved for the session-owned destroy lifecycle.

App::on_window_event

fn App::on_window_event(self : App, handler : async (WindowHandle, WindowEvent) -> Unit noraise) -> App

Observes coalesced native state changes for every running window.

App::path

fn App::path(self : App, kind : AppPathKind) -> String raise AppPathError

Resolves a standard application path.

UserData, SessionData, and Logs use the application's stable reverse-DNS identifier instead of its display name so package renames do not move persisted state.

App::run

async fn App::run(self : App) -> Unit raise AppRunError

Runs the configured app through the native Proton runtime.

App::run_or_abort

async fn App::run_or_abort(self : App) -> Unit

Runs the configured app and aborts with the error message on failure.

App::set_app_logs_path

fn App::set_app_logs_path(self : App, path? : String) -> App raise AppPathError

Selects the application log directory before runtime startup.

A custom absolute path is created when the application starts. Omitting the path selects Electron's default: the platform log directory on macOS and a logs directory inside UserData on Windows and Linux.

App::set_path

fn App::set_path(self : App, kind : AppPathKind, path : String) -> App raise AppPathError

Overrides a standard application path before the application runtime starts.

The path must be absolute and already exist, matching Electron's setPath validation. Runtime-owned paths such as SessionData and Logs are consumed by Proton startup in addition to being returned by App::path.

App::single_instance

fn App::single_instance(self : App, enabled? : Bool) -> App

Ensures only one operating-system process owns this application identity. Later processes forward their URL, document, or reopen activation and exit.

App::size

fn App::size(self : App, width~ : Int, height~ : Int) -> App

Sets the primary window size.

App::title

fn App::title(self : App, title : String) -> App

Sets the primary window title.

App::titlebar_style

fn App::titlebar_style(self : App, style : TitlebarStyle) -> App

Sets whether web content remains below or extends beneath the native titlebar. Overlay rendering is currently implemented on macOS and Windows.

App::update_channel

fn App::update_channel(self : App, endpoint : String, public_keys : Array[String], check_on_launch? : Bool, freshness_days? : Int) -> App

Configures the signed update channel used by this application.

App::url_scheme

fn App::url_scheme(self : App, scheme : String) -> App

Declares an application URL scheme for launch forwarding and protocol-client controls. Package configuration must declare the same scheme so distributed applications contain the required platform metadata.

App::version

fn App::version(self : App) -> String raise AppMetadataError

Returns the application version from managed development or packaged metadata.

App::window_lifecycle

fn[State] App::window_lifecycle(self : App, on_ready~ : async (WindowContext) -> State, on_close~ : async (State) -> Unit) -> App

Adds a paired primary-window lifecycle hook.

The ready state is passed to close. Completed hooks close in reverse order, including when a later ready hook fails.

App::with_view

fn App::with_view(self : App, id : String, config : ViewConfig) -> App

Attaches a web contents view to the primary window at startup, the declarative counterpart of WindowHandle::add_view: the view is created with the window and can later be found through WindowHandle::view(id) or observed through App::on_view_event. Use the imperative WindowHandle::add_view for views whose lifetime is dynamic.

AppPathKind

pub(all) enum AppPathKind {
Home
AppData
UserData
SessionData
Temp
Executable
Logs
Assets
Module
Desktop
Documents
Downloads
Music
Pictures
Videos
Recent
} derive(Eq,
Debug
)

Standard application paths corresponding to Electron's high-frequency app.getPath names.

AppPathKind::equal

fn AppPathKind::equal(AppPathKind, AppPathKind) -> Bool

AppPathKind::not_equal

fn AppPathKind::not_equal(x : AppPathKind, y : AppPathKind) -> Bool

ApplicationContext

pub struct ApplicationContext {
tasks :
TaskGroup
[Unit]
windows : WindowManager
locale_preferences :
LocalePreferences

request_quit : () -> Unit
application_identifier : String
application_executable : String
application_arguments : Array[String]
url_schemes : Array[String]
}

Application-lifetime capabilities supplied to startup hooks.

ApplicationContext::exit

fn ApplicationContext::exit(self : ApplicationContext, exit_code? : Int) -> Unit

Immediately terminates the process with exit_code.

This skips window close interception and lifecycle shutdown hooks. Any relaunches already scheduled through relaunch are started first.

ApplicationContext::is_default_protocol_client

fn ApplicationContext::is_default_protocol_client(self : ApplicationContext, scheme : String, executable? : String, arguments? : Array[String]) -> Bool raise AppControlError

Reports whether this application handles a declared URL scheme by default.

ApplicationContext::locale

Returns the immutable application locale selected at startup.

ApplicationContext::preferred_languages

Returns the application's ordered language preferences.

ApplicationContext::quit

fn ApplicationContext::quit(self : ApplicationContext) -> Unit

Requests an orderly application shutdown.

Proton closes every open window, runs configured close interception, and destroys the native runtime after all windows have closed. A denied window close cancels this quit request.

ApplicationContext::relaunch

fn ApplicationContext::relaunch(self : ApplicationContext, options? : RelaunchOptions) -> Unit raise AppControlError

Schedules a new application instance after the current instance exits.

Calling this method multiple times schedules multiple instances. It does not quit the current application; call quit or exit separately.

ApplicationContext::remove_default_protocol_client

fn ApplicationContext::remove_default_protocol_client(self : ApplicationContext, scheme : String, executable? : String, arguments? : Array[String]) -> Bool raise AppControlError

Removes this application as the default handler for a declared URL scheme.

Electron exposes removal on macOS and Windows. Linux returns false.

ApplicationContext::set_as_default_protocol_client

fn ApplicationContext::set_as_default_protocol_client(self : ApplicationContext, scheme : String, executable? : String, arguments? : Array[String]) -> Bool raise AppControlError

Sets this application as the default handler for a declared URL scheme.

executable and arguments match Electron's Windows-only command override. Other platforms use the packaged application identity.

ApplicationContext::task_group

Returns the structured task group owned by this application.

ApplicationContext::windows

Returns the window manager owned by this running application.

BridgeDiagnostic

pub(all) struct BridgeDiagnostic {
stage : String
code : String
message : String
page_instance : String
url : String
owner : String?
source_url : String?
source_line : String?
line : Int?
column : Int?
stack : String?
additional_failure_count : Int?
details_truncated : Bool
} derive(Eq,
Debug
)

Structured information about a bridge bootstrap or runtime failure.

BridgeDiagnostic::equal

BridgeDiagnostic::not_equal

fn BridgeDiagnostic::not_equal(x : BridgeDiagnostic, y : BridgeDiagnostic) -> Bool

BrowserEvent

pub(all) enum BrowserEvent {
LoadingChanged(is_loading~ : Bool)
Navigated(url~ : String)
TitleUpdated(title~ : String)
LoadFailed(url~ : String, error_code~ : Int, error_text~ : String)
FoundInPage(result~ : FindInPageResult)
PdfPrinted(result~ : PdfPrintResult)
} derive(Eq,
Debug
)

An observed lifecycle change for a window's main browser page.

BrowserEvent::equal

BrowserEvent::not_equal

fn BrowserEvent::not_equal(x : BrowserEvent, y : BrowserEvent) -> Bool

BrowserHandle

pub struct BrowserHandle {
id : String
native_id : Int64
load_browser_url : (String) -> Unit raise WindowSessionError
load_browser_html : (String, String) -> Unit raise WindowSessionError
eval_browser_script : (String) -> Unit raise WindowSessionError
focus_browser : () -> Unit raise WindowSessionError
send_browser_command : (String, Int?) -> Unit raise WindowSessionError
download_browser_url : (String) -> Unit raise WindowSessionError
print_browser : () -> Unit raise WindowSessionError
print_browser_to_pdf : (String, PdfPrintOptions) -> Int raise WindowSessionError
find_browser_in_page : (String, Bool, Bool, Bool) -> Int raise WindowSessionError
stop_browser_find : (Bool) -> Unit raise WindowSessionError
set_browser_zoom_percent : (Int) -> Unit raise WindowSessionError
read_browser_zoom_percent : () -> Int raise WindowSessionError
set_browser_audio_muted : (Bool) -> Unit raise WindowSessionError
read_browser_audio_muted : () -> Bool raise WindowSessionError
read_browser_navigation_state : () -> (Bool, Bool) raise WindowSessionError
read_browser_focused : () -> Bool raise WindowSessionError
read_browser_devtools_opened : () -> Bool raise WindowSessionError
read_browser_state : () -> BrowserState raise WindowSessionError
session_handle : SessionHandle
}

BrowserHandle::back

fn BrowserHandle::back(self : BrowserHandle) -> Unit raise WindowSessionError

BrowserHandle::can_go_back

fn BrowserHandle::can_go_back(self : BrowserHandle) -> Bool raise WindowSessionError

Returns whether the main browser can navigate to a previous history entry.

BrowserHandle::can_go_forward

fn BrowserHandle::can_go_forward(self : BrowserHandle) -> Bool raise WindowSessionError

Returns whether the main browser can navigate to a later history entry.

BrowserHandle::cancel_download

fn BrowserHandle::cancel_download(self : BrowserHandle, download_id : Int) -> Unit raise WindowSessionError

BrowserHandle::close_devtools

fn BrowserHandle::close_devtools(self : BrowserHandle) -> Unit raise WindowSessionError

BrowserHandle::copy

fn BrowserHandle::copy(self : BrowserHandle) -> Unit raise WindowSessionError

Copies the current selection in the focused frame.

BrowserHandle::cut

fn BrowserHandle::cut(self : BrowserHandle) -> Unit raise WindowSessionError

Cuts the current selection in the focused frame.

BrowserHandle::delete

fn BrowserHandle::delete(self : BrowserHandle) -> Unit raise WindowSessionError

Deletes the current selection in the focused frame.

BrowserHandle::download_url

fn BrowserHandle::download_url(self : BrowserHandle, url : String) -> Unit raise WindowSessionError

Starts downloading url without navigating the page. The request uses the app's download approval and progress handlers. CEF does not support Electron's optional custom request headers for this operation.

BrowserHandle::eval

fn BrowserHandle::eval(self : BrowserHandle, script : String) -> Unit raise WindowSessionError

BrowserHandle::find_in_page

fn BrowserHandle::find_in_page(self : BrowserHandle, text : String, forward? : Bool, match_case? : Bool, find_next? : Bool) -> Int raise WindowSessionError

Starts or advances a page search and returns its request id. Set find_next=true to begin a new search session, matching Electron's findInPage option; leave it false to advance the current session.

BrowserHandle::focus

fn BrowserHandle::focus(self : BrowserHandle) -> Unit raise WindowSessionError

Focuses the web page, matching Electron webContents.focus().

BrowserHandle::forward

fn BrowserHandle::forward(self : BrowserHandle) -> Unit raise WindowSessionError

BrowserHandle::is_audio_muted

fn BrowserHandle::is_audio_muted(self : BrowserHandle) -> Bool raise WindowSessionError

Returns whether audio produced by the main browser page is muted.

BrowserHandle::is_devtools_opened

fn BrowserHandle::is_devtools_opened(self : BrowserHandle) -> Bool raise WindowSessionError

Returns whether this web contents currently has an open DevTools view.

BrowserHandle::is_focused

fn BrowserHandle::is_focused(self : BrowserHandle) -> Bool raise WindowSessionError

Returns whether the web page currently owns focus.

BrowserHandle::load_html

fn BrowserHandle::load_html(self : BrowserHandle, html : String, base_url : String) -> Unit raise WindowSessionError

BrowserHandle::load_url

fn BrowserHandle::load_url(self : BrowserHandle, url : String) -> Unit raise WindowSessionError

BrowserHandle::open_devtools

fn BrowserHandle::open_devtools(self : BrowserHandle) -> Unit raise WindowSessionError

BrowserHandle::paste

fn BrowserHandle::paste(self : BrowserHandle) -> Unit raise WindowSessionError

Pastes clipboard contents into the focused frame.

BrowserHandle::paste_and_match_style

fn BrowserHandle::paste_and_match_style(self : BrowserHandle) -> Unit raise WindowSessionError

Pastes clipboard contents using the destination's current style.

BrowserHandle::print

fn BrowserHandle::print(self : BrowserHandle) -> Unit raise WindowSessionError

Opens the platform print flow for the main browser contents.

BrowserHandle::print_to_pdf

fn BrowserHandle::print_to_pdf(self : BrowserHandle, path : String, options? : PdfPrintOptions) -> Int raise WindowSessionError

Starts printing the main browser contents to path and returns a request id. Completion is delivered as BrowserEvent::PdfPrinted.

BrowserHandle::redo

fn BrowserHandle::redo(self : BrowserHandle) -> Unit raise WindowSessionError

Redoes the most recently undone edit in the focused frame.

BrowserHandle::reload

fn BrowserHandle::reload(self : BrowserHandle, ignore_cache? : Bool) -> Unit raise WindowSessionError

BrowserHandle::select_all

fn BrowserHandle::select_all(self : BrowserHandle) -> Unit raise WindowSessionError

Selects all editable content in the focused frame.

BrowserHandle::session

Returns the browser session used by this main page.

BrowserHandle::set_audio_muted

fn BrowserHandle::set_audio_muted(self : BrowserHandle, muted : Bool) -> Unit raise WindowSessionError

Mutes or unmutes audio produced by the main browser page.

BrowserHandle::set_zoom_percent

fn BrowserHandle::set_zoom_percent(self : BrowserHandle, zoom_percent : Int) -> Unit raise WindowSessionError

Sets the main browser zoom from 25% through 500%.

BrowserHandle::state

Reads the current main browser page state.

BrowserHandle::stop

fn BrowserHandle::stop(self : BrowserHandle) -> Unit raise WindowSessionError

BrowserHandle::stop_find_in_page

fn BrowserHandle::stop_find_in_page(self : BrowserHandle, clear_selection? : Bool) -> Unit raise WindowSessionError

Stops the active page search. Set clear_selection=false to preserve the current match highlight.

BrowserHandle::toggle_devtools

fn BrowserHandle::toggle_devtools(self : BrowserHandle) -> Unit raise WindowSessionError

Toggles the DevTools view for this web contents.

BrowserHandle::undo

fn BrowserHandle::undo(self : BrowserHandle) -> Unit raise WindowSessionError

Undoes the most recent edit in the focused frame.

BrowserHandle::window_id

fn BrowserHandle::window_id(self : BrowserHandle) -> String

BrowserHandle::zoom_percent

fn BrowserHandle::zoom_percent(self : BrowserHandle) -> Int raise WindowSessionError

Returns the main browser zoom percentage.

BrowserPermissionDecision

pub(all) enum BrowserPermissionDecision {
Allow
Deny
} derive(Eq,
Debug
)

BrowserPermissionDecision::equal

BrowserPermissionDecision::not_equal

BrowserState

pub(all) struct BrowserState {
url : String
title : String
is_loading : Bool
can_go_back : Bool
can_go_forward : Bool
} derive(Eq,
Debug
)

A point-in-time snapshot of a window's main browser page.

BrowserState::equal

BrowserState::not_equal

fn BrowserState::not_equal(x : BrowserState, y : BrowserState) -> Bool

CertificateError

pub(all) struct CertificateError {
url : String
error_code : Int
} derive(Eq,
Debug
)

CertificateError::equal

CertificateError::not_equal

fn CertificateError::not_equal(x : CertificateError, y : CertificateError) -> Bool

pub(all) struct Cookie {
name : String
value : String
domain : String
path : String
secure : Bool
http_only : Bool
same_site : CookieSameSite
expiration_date : Double?
} derive(Eq,
Debug
)

One cookie returned by the browser session.

Cookie::equal

fn Cookie::equal(Cookie, Cookie) -> Bool

Cookie::not_equal

fn Cookie::not_equal(x : Cookie, y : Cookie) -> Bool

Cookie::to_repr

CookieSameSite

pub(all) enum CookieSameSite {
Unspecified
NoRestriction
Lax
Strict
} derive(Eq,
Debug
)

SameSite policy for a browser cookie.

CookieSameSite::equal

CookieSameSite::not_equal

fn CookieSameSite::not_equal(x : CookieSameSite, y : CookieSameSite) -> Bool

DownloadDecision

pub(all) enum DownloadDecision {
Deny
ShowSaveDialog
SaveTo(String)
} derive(Eq,
Debug
)

DownloadDecision::equal

DownloadDecision::not_equal

fn DownloadDecision::not_equal(x : DownloadDecision, y : DownloadDecision) -> Bool

DownloadEvent

pub(all) struct DownloadEvent {
id : Int
state : String
received_bytes : Int64
total_bytes : Int64
percent : Int
} derive(Eq,
Debug
)

DownloadEvent::equal

DownloadEvent::not_equal

fn DownloadEvent::not_equal(x : DownloadEvent, y : DownloadEvent) -> Bool

DownloadRequest

pub(all) struct DownloadRequest {
id : Int
url : String
suggested_name : String
} derive(Eq,
Debug
)

DownloadRequest::equal

DownloadRequest::not_equal

fn DownloadRequest::not_equal(x : DownloadRequest, y : DownloadRequest) -> Bool

FindInPageResult

pub(all) struct FindInPageResult {
request_id : Int
active_match_ordinal : Int
matches : Int
selection_x : Int
selection_y : Int
selection_width : Int
selection_height : Int
final_update : Bool
} derive(Eq,
Debug
)

One update from an active page search. The selection rectangle uses the target web contents coordinate space.

FindInPageResult::equal

FindInPageResult::not_equal

fn FindInPageResult::not_equal(x : FindInPageResult, y : FindInPageResult) -> Bool

LastWindowClosedPolicy

pub(all) enum LastWindowClosedPolicy {
Quit
KeepRunning
} derive(Eq,
Debug
)

Controls what Proton does after the last application window closes.

LastWindowClosedPolicy::equal

LastWindowClosedPolicy::not_equal

MediaPermissionRequest

pub(all) struct MediaPermissionRequest {
origin : String
permissions : Int
} derive(Eq,
Debug
)

MediaPermissionRequest::equal

MediaPermissionRequest::not_equal

pub struct Menu {
label : String?
role : MenuRole?
items : Array[MenuItem]?
}

A top-level native menu and its items.
fn Menu::Menu(label : String, items~ : Array[MenuItem]) -> Menu

fn Menu::popup(self : Menu, window : WindowHandle, x : Int, y : Int) -> Unit raise WindowSessionError

Pops up this menu as a window-level context menu at view-relative coordinates (top-left origin, CSS pixels) inside window. Command items deliver through the same menu.command event path as the application menu bar; role items invoke their platform-native actions.
fn Menu::role(role : MenuRole, label? : String, items? : Array[MenuItem]) -> Menu

Creates a standard top-level menu. Omitted items select the role defaults; an explicit item array replaces those defaults exactly.
pub struct MenuBar {
menus : Array[Menu]
}

An application-level native menu bar.
fn MenuBar::MenuBar(menus~ : Array[Menu]) -> MenuBar

pub struct MenuItem {
kind : Int
id : String?
label : String?
key : String?
role : MenuItemRole?
submenu : Menu?
enabled : Bool
visible : Bool
checked : Bool?
}

A command, separator, or platform role in a native application menu.
fn MenuItem::command(id : String, label : String, key? : String, enabled? : Bool, visible? : Bool, checked? : Bool) -> MenuItem

Creates a command item. enabled and visible control native presentation. Passing checked creates a checkbox command item; omitting it creates a normal command item.
fn MenuItem::role(role : MenuItemRole, label? : String, key? : String) -> MenuItem

fn MenuItem::separator() -> MenuItem

fn MenuItem::submenu(label : String, items~ : Array[MenuItem]) -> MenuItem

Creates a nested submenu item with its own set of items.
pub(all) enum MenuItemRole {
Quit
Hide
HideOthers
ShowAll
Close
Minimize
Zoom
Undo
Redo
Cut
Copy
Paste
SelectAll
} derive(Eq,
Debug
)

A standard native menu action.

fn MenuItemRole::not_equal(x : MenuItemRole, y : MenuItemRole) -> Bool

pub(all) enum MenuRole {
Application
File
Edit
View
Window
Help
} derive(Eq,
Debug
)

A standard top-level application menu role.
fn MenuRole::equal(MenuRole, MenuRole) -> Bool

fn MenuRole::not_equal(x : MenuRole, y : MenuRole) -> Bool

pub(all) enum NavigationDecision {
Allow
Deny
} derive(Eq,
Debug
)

pub(all) struct NavigationRequest {
url : String
http_method : String
user_gesture : Bool
redirect : Bool
} derive(Eq,
Debug
)

fn NavigationRequest::not_equal(x : NavigationRequest, y : NavigationRequest) -> Bool

PdfPrintMargins

pub(all) enum PdfPrintMargins {
Default
NoMargins
Custom(top~ : Double, right~ : Double, bottom~ : Double, left~ : Double)
} derive(Eq,
Debug
)

Margins used when printing browser contents to PDF.

PdfPrintMargins::equal

PdfPrintMargins::not_equal

fn PdfPrintMargins::not_equal(x : PdfPrintMargins, y : PdfPrintMargins) -> Bool

PdfPrintOptions

pub(all) struct PdfPrintOptions {
landscape : Bool
print_background : Bool
scale : Double
paper_width : Double
paper_height : Double
prefer_css_page_size : Bool
margins : PdfPrintMargins
page_ranges : String
display_header_footer : Bool
header_template : String
footer_template : String
generate_tagged_pdf : Bool
generate_document_outline : Bool
} derive(Eq,
Debug
)

Electron-style PDF print settings. Paper dimensions and custom margins use inches, and scale must be between 0.1 and 2.0. An empty page range prints the complete document.

PdfPrintOptions::PdfPrintOptions

fn PdfPrintOptions::PdfPrintOptions(landscape? : Bool, print_background? : Bool, scale? : Double, paper_width? : Double, paper_height? : Double, prefer_css_page_size? : Bool, margins? : PdfPrintMargins, page_ranges? : String, display_header_footer? : Bool, header_template? : String, footer_template? : String, generate_tagged_pdf? : Bool, generate_document_outline? : Bool) -> PdfPrintOptions

PdfPrintOptions::equal

PdfPrintOptions::not_equal

fn PdfPrintOptions::not_equal(x : PdfPrintOptions, y : PdfPrintOptions) -> Bool

PdfPrintResult

pub(all) struct PdfPrintResult {
request_id : Int
path : String
success : Bool
} derive(Eq,
Debug
)

Completion of one print_to_pdf request.

PdfPrintResult::equal

PdfPrintResult::not_equal

fn PdfPrintResult::not_equal(x : PdfPrintResult, y : PdfPrintResult) -> Bool

PendingUpdate

pub struct PendingUpdate {
version : String
revision : UInt64
notes_url : String?
size : Int64
channel :
UpdateChannel

offer :
AvailableUpdate

}

An update the channel offered, and the means to take it.

Being handed one means the manifest was signed by a trusted key, is fresh, and carries a revision newer than the installed one. Nothing has been downloaded.

PendingUpdate::install

async fn PendingUpdate::install(self : PendingUpdate, on_progress? : async (Int64) -> Unit noraise) -> UpdateInstallOutcome

Downloads this update and prepares or applies its platform replacement.

Downloaded chunks are written only to a private native stage while their size, digest, and signature are checked. The stage cannot be consumed unless that authentication completes. macOS and Linux replace the installed artifact here. Windows keeps the verified NSIS installer locked until restart, because the running process cannot replace its own install tree. The application is not restarted — see restart.

This is deliberately not something the framework does on its own. Checking without being asked is a reasonable default; installing without being asked changes the code someone is running, and only the application knows whether this is a moment when that is acceptable.

PendingUpdate::notes_url

fn PendingUpdate::notes_url(self : PendingUpdate) -> String?

Where the release notes for it live, when the manifest says.

PendingUpdate::restart

fn PendingUpdate::restart(_self : PendingUpdate) -> Unit raise

Starts the installed replacement. The caller should exit afterwards.

Returning without an error means the system accepted the request, not that the new version is running: it decides that afterwards and does not report back.

PendingUpdate::revision

fn PendingUpdate::revision(self : PendingUpdate) -> UInt64

The signed monotonic release order.

PendingUpdate::size

fn PendingUpdate::size(self : PendingUpdate) -> Int64

How many bytes taking it will transfer.

PendingUpdate::version

fn PendingUpdate::version(self : PendingUpdate) -> String

The version on offer.

PopupDecision

pub(all) enum PopupDecision {
Deny
OpenInCurrent
OpenInWindow(String)
} derive(Eq,
Debug
)

PopupDecision::equal

PopupDecision::not_equal

fn PopupDecision::not_equal(x : PopupDecision, y : PopupDecision) -> Bool

PopupRequest

pub(all) struct PopupRequest {
url : String
disposition : Int
user_gesture : Bool
} derive(Eq,
Debug
)

PopupRequest::equal

PopupRequest::not_equal

fn PopupRequest::not_equal(x : PopupRequest, y : PopupRequest) -> Bool

RelaunchOptions

pub(all) struct RelaunchOptions {
executable : String?
arguments : Array[String]?
} derive(Eq,
Debug
)

Optional command override for ApplicationContext::relaunch.

With neither field set, Proton repeats the current executable and command line. Setting either field switches to Electron's override behavior: the executable still defaults to the current executable, while omitted arguments become an empty array.

RelaunchOptions::RelaunchOptions

fn RelaunchOptions::RelaunchOptions(executable? : String, arguments? : Array[String]) -> RelaunchOptions

RelaunchOptions::equal

RelaunchOptions::not_equal

fn RelaunchOptions::not_equal(x : RelaunchOptions, y : RelaunchOptions) -> Bool

RendererTarget

pub struct RendererTarget {
window : String
bundled : Bool
}

Identifies one renderer page that may use a capability.

RendererTarget::bundled

fn RendererTarget::bundled(window? : String) -> RendererTarget

Selects Proton's bundled application origin in one window as a renderer capability target.

RendererTarget::entry

fn RendererTarget::entry(window? : String) -> RendererTarget

Selects a window's configured entry as a renderer capability target.

RuntimeLaunchInput

pub(all) enum RuntimeLaunchInput {
OpenUrls(Array[String])
OpenFiles(Array[String])
Reopen
} derive(Eq,
Debug
)

An operating-system request delivered to an already running application.

RuntimeLaunchInput::equal

RuntimeLaunchInput::not_equal

ScreenInfo

pub(all) struct ScreenInfo {
id : Int
x : Int
y : Int
width : Int
height : Int
work_x : Int
work_y : Int
work_width : Int
work_height : Int
scale_factor_percent : Int
is_primary : Bool
} derive(Eq,
Debug
)

Information about one connected display.

ScreenInfo::equal

fn ScreenInfo::equal(ScreenInfo, ScreenInfo) -> Bool

ScreenInfo::not_equal

fn ScreenInfo::not_equal(x : ScreenInfo, y : ScreenInfo) -> Bool

SessionHandle

pub struct SessionHandle {
id : String
native_id : Int64
read_cookies : async (String?, Bool) -> Array[Cookie] raise WindowSessionError
write_cookie : (String, String, String, String?, String?, Bool, Bool, CookieSameSite) -> Unit raise WindowSessionError
remove_cookies : (String?, String?) -> Unit raise WindowSessionError
flush_cookie_store : () -> Unit raise WindowSessionError
clear_http_cache : () -> Unit raise WindowSessionError
}

A non-owning reference to the request context used by one window's main browser, corresponding to Electron's webContents.session.

SessionHandle::clear_cache

fn SessionHandle::clear_cache(self : SessionHandle) -> Unit raise WindowSessionError

Clears the session's HTTP cache.

SessionHandle::delete_cookies

fn SessionHandle::delete_cookies(self : SessionHandle, url? : String, name? : String) -> Unit raise WindowSessionError

Deletes matching cookies. Omitting both filters deletes all cookies.

SessionHandle::flush_cookies

fn SessionHandle::flush_cookies(self : SessionHandle) -> Unit raise WindowSessionError

Flushes pending cookie changes to disk.

SessionHandle::get_cookies

async fn SessionHandle::get_cookies(self : SessionHandle, url? : String, include_http_only? : Bool) -> Array[Cookie] raise WindowSessionError

Returns cookies visible to the session, optionally restricted to one URL.
fn SessionHandle::set_cookie(self : SessionHandle, url : String, name : String, value : String, domain? : String, path? : String, secure? : Bool, http_only? : Bool, same_site? : CookieSameSite) -> Unit raise WindowSessionError

Sets a cookie in the session's cookie store.

SessionHandle::window_id

fn SessionHandle::window_id(self : SessionHandle) -> String

Returns the window id whose request context owns this session.

TitlebarStyle

pub(all) enum TitlebarStyle {
Default
Overlay
} derive(Eq,
Debug
)

Controls whether web content stays below or extends beneath the titlebar.

TitlebarStyle::equal

TitlebarStyle::not_equal

fn TitlebarStyle::not_equal(x : TitlebarStyle, y : TitlebarStyle) -> Bool

UpdateCheck

pub enum UpdateCheck {
NotConfigured
UpToDate
Available(PendingUpdate)
}

What asking the channel concluded.

UpdateInstallOutcome

pub enum UpdateInstallOutcome {
Installed
AlreadyInstalled
} derive(Eq,
Debug
)

What applying an update changed.

UpdateInstallOutcome::equal

UpdateInstallOutcome::not_equal

ViewConfig

pub struct ViewConfig {
x : Int
y : Int
width : Int
height : Int
visible : Bool
z_order : Int
initial_url : String
background_color : String?
}

Configuration for a web contents view hosted inside a window.

ViewConfig::ViewConfig

fn ViewConfig::ViewConfig(width~ : Int, height~ : Int, x? : Int, y? : Int, visible? : Bool, z_order? : Int, initial_url? : String, background_color? : String) -> ViewConfig

ViewEvent

pub(all) enum ViewEvent {
LoadingChanged(is_loading~ : Bool)
Navigated(url~ : String)
TitleUpdated(title~ : String)
LoadFailed(url~ : String, error_code~ : Int, error_text~ : String)
FoundInPage(result~ : FindInPageResult)
Closed
} derive(Eq,
Debug
)

An observed change to a running web contents view, following Electron webContents lifecycle and page-search events.

ViewEvent::equal

fn ViewEvent::equal(ViewEvent, ViewEvent) -> Bool

ViewEvent::not_equal

fn ViewEvent::not_equal(x : ViewEvent, y : ViewEvent) -> Bool

ViewHandle

pub struct ViewHandle {
id : String
native_id : Int64
set_view_bounds : (Int, Int, Int, Int) -> Unit raise WindowSessionError
set_view_visible : (Bool) -> Unit raise WindowSessionError
set_view_z_order : (Int) -> Unit raise WindowSessionError
set_view_zoom_percent : (Int) -> Unit raise WindowSessionError
read_view_zoom_percent : () -> Int raise WindowSessionError
set_view_audio_muted : (Bool) -> Unit raise WindowSessionError
read_view_audio_muted : () -> Bool raise WindowSessionError
load_view_url : (String) -> Unit raise WindowSessionError
load_view_html : (String, String) -> Unit raise WindowSessionError
eval_view_script : (String) -> Unit raise WindowSessionError
focus_view : () -> Unit raise WindowSessionError
send_view_command : (String, Int?) -> Unit raise WindowSessionError
find_view_in_page : (String, Bool, Bool, Bool) -> Int raise WindowSessionError
stop_view_find : (Bool) -> Unit raise WindowSessionError
read_view_navigation_state : () -> (Bool, Bool) raise WindowSessionError
read_view_focused : () -> Bool raise WindowSessionError
read_view_devtools_opened : () -> Bool raise WindowSessionError
read_view_state : () -> ViewState raise WindowSessionError
close_view : () -> Unit raise WindowSessionError
}

A non-owning reference to one concrete web contents view instance.

Views follow the Electron WebContentsView model: each view is an independent web page hosted inside its owning window's content area with explicit top-left bounds, visibility, and z-order. The instance id prevents a stale handle from targeting a later view that reuses the same declarative id.

ViewHandle::back

fn ViewHandle::back(self : ViewHandle) -> Unit raise WindowSessionError

ViewHandle::can_go_back

fn ViewHandle::can_go_back(self : ViewHandle) -> Bool raise WindowSessionError

Returns whether the view can navigate to a previous history entry.

ViewHandle::can_go_forward

fn ViewHandle::can_go_forward(self : ViewHandle) -> Bool raise WindowSessionError

Returns whether the view can navigate to a later history entry.

ViewHandle::close

fn ViewHandle::close(self : ViewHandle) -> Unit raise WindowSessionError

Removes and destroys the view, the Electron removeChildView equivalent.

ViewHandle::close_devtools

fn ViewHandle::close_devtools(self : ViewHandle) -> Unit raise WindowSessionError

ViewHandle::copy

fn ViewHandle::copy(self : ViewHandle) -> Unit raise WindowSessionError

Copies the current selection in the focused frame.

ViewHandle::cut

fn ViewHandle::cut(self : ViewHandle) -> Unit raise WindowSessionError

Cuts the current selection in the focused frame.

ViewHandle::delete

fn ViewHandle::delete(self : ViewHandle) -> Unit raise WindowSessionError

Deletes the current selection in the focused frame.

ViewHandle::eval

fn ViewHandle::eval(self : ViewHandle, script : String) -> Unit raise WindowSessionError

Executes JavaScript in the view's main frame without awaiting a result.

ViewHandle::find_in_page

fn ViewHandle::find_in_page(self : ViewHandle, text : String, forward? : Bool, match_case? : Bool, find_next? : Bool) -> Int raise WindowSessionError

Starts or advances a page search and returns its request id. Set find_next=true to begin a new search session, matching Electron's findInPage option; leave it false to advance the current session.

ViewHandle::focus

fn ViewHandle::focus(self : ViewHandle) -> Unit raise WindowSessionError

Focuses this view's web page, matching Electron webContents.focus().

ViewHandle::forward

fn ViewHandle::forward(self : ViewHandle) -> Unit raise WindowSessionError

ViewHandle::id

fn ViewHandle::id(self : ViewHandle) -> String

Returns the declarative id of this view.

ViewHandle::is_audio_muted

fn ViewHandle::is_audio_muted(self : ViewHandle) -> Bool raise WindowSessionError

Returns whether audio produced by this view's page is muted.

ViewHandle::is_devtools_opened

fn ViewHandle::is_devtools_opened(self : ViewHandle) -> Bool raise WindowSessionError

Returns whether this web contents currently has an open DevTools view.

ViewHandle::is_focused

fn ViewHandle::is_focused(self : ViewHandle) -> Bool raise WindowSessionError

Returns whether this view's web page currently owns focus.

ViewHandle::load_html

fn ViewHandle::load_html(self : ViewHandle, html : String, base_url : String) -> Unit raise WindowSessionError

Loads inline HTML into the view, served from base_url on the proton:// scheme, mirroring WindowHandle::load_html.

ViewHandle::load_url

fn ViewHandle::load_url(self : ViewHandle, url : String) -> Unit raise WindowSessionError

Navigates the view's page, the Electron view.webContents.loadURL equivalent.

ViewHandle::open_devtools

fn ViewHandle::open_devtools(self : ViewHandle) -> Unit raise WindowSessionError

ViewHandle::paste

fn ViewHandle::paste(self : ViewHandle) -> Unit raise WindowSessionError

Pastes clipboard contents into the focused frame.

ViewHandle::paste_and_match_style

fn ViewHandle::paste_and_match_style(self : ViewHandle) -> Unit raise WindowSessionError

Pastes clipboard contents using the destination's current style.

ViewHandle::redo

fn ViewHandle::redo(self : ViewHandle) -> Unit raise WindowSessionError

Redoes the most recently undone edit in the focused frame.

ViewHandle::reload

fn ViewHandle::reload(self : ViewHandle, ignore_cache? : Bool) -> Unit raise WindowSessionError

ViewHandle::select_all

fn ViewHandle::select_all(self : ViewHandle) -> Unit raise WindowSessionError

Selects all editable content in the focused frame.

ViewHandle::set_audio_muted

fn ViewHandle::set_audio_muted(self : ViewHandle, muted : Bool) -> Unit raise WindowSessionError

Mutes or unmutes audio produced by this view's page.

ViewHandle::set_bounds

fn ViewHandle::set_bounds(self : ViewHandle, x~ : Int, y~ : Int, width~ : Int, height~ : Int) -> Unit raise WindowSessionError

Moves and resizes the view. x/y use a top-left origin in the owning window's content coordinate space, matching Electron's setBounds.

ViewHandle::set_visible

fn ViewHandle::set_visible(self : ViewHandle, visible : Bool) -> Unit raise WindowSessionError

ViewHandle::set_z_order

fn ViewHandle::set_z_order(self : ViewHandle, z_order : Int) -> Unit raise WindowSessionError

Stacks the view relative to the window's other views; higher z_order renders above lower values.

ViewHandle::set_zoom_percent

fn ViewHandle::set_zoom_percent(self : ViewHandle, zoom_percent : Int) -> Unit raise WindowSessionError

Sets this view's browser zoom from 25% through 500%.

ViewHandle::state

Reads the current view state from the native runtime.

ViewHandle::stop

fn ViewHandle::stop(self : ViewHandle) -> Unit raise WindowSessionError

ViewHandle::stop_find_in_page

fn ViewHandle::stop_find_in_page(self : ViewHandle, clear_selection? : Bool) -> Unit raise WindowSessionError

Stops the active page search. Set clear_selection=false to preserve the current match highlight.

ViewHandle::toggle_devtools

fn ViewHandle::toggle_devtools(self : ViewHandle) -> Unit raise WindowSessionError

Toggles the DevTools view for this web contents.

ViewHandle::undo

fn ViewHandle::undo(self : ViewHandle) -> Unit raise WindowSessionError

Undoes the most recent edit in the focused frame.

ViewHandle::zoom_percent

fn ViewHandle::zoom_percent(self : ViewHandle) -> Int raise WindowSessionError

Returns this view's browser zoom percentage.

ViewState

pub(all) struct ViewState {
x : Int
y : Int
width : Int
height : Int
visible : Bool
z_order : Int
} derive(Eq,
Debug
)

A point-in-time web contents view state snapshot.

ViewState::equal

fn ViewState::equal(ViewState, ViewState) -> Bool

ViewState::not_equal

fn ViewState::not_equal(x : ViewState, y : ViewState) -> Bool

WindowCloseDecision

pub(all) enum WindowCloseDecision {
Allow
Deny
} derive(Eq,
Debug
)

The result of an asynchronous native close request.

WindowCloseDecision::equal

WindowCloseDecision::not_equal

WindowContext

pub struct WindowContext {
id : String
handle : WindowHandle
windows : WindowManager
tasks :
TaskGroup
[Unit]
events : WindowEventEmitter
locale_preferences :
LocalePreferences

}

Window-lifetime capabilities supplied to window startup hooks.

WindowContext::events

Returns an event emitter bound to this window's active page.

WindowContext::handle

Returns the session-controlled handle for this concrete window instance.

WindowContext::id

fn WindowContext::id(self : WindowContext) -> String

Returns the declarative id of this window. The primary window uses "main".

WindowContext::locale

Returns the immutable application locale selected at startup.

WindowContext::preferred_languages

Returns the application's ordered language preferences.

WindowContext::task_group

Returns the structured task group owned by this window.

WindowContext::windows

Returns the application window manager.

WindowEvent

pub(all) enum WindowEvent {
StateChanged(WindowState)
} derive(Eq,
Debug
)

An observed change to a running native window.

WindowEvent::equal

fn WindowEvent::equal(WindowEvent, WindowEvent) -> Bool

WindowEvent::not_equal

fn WindowEvent::not_equal(x : WindowEvent, y : WindowEvent) -> Bool

WindowEventEmitter

pub struct WindowEventEmitter {
emit_event : async (
ContractRoute
, String, Json) -> Unit noraise
}

A typed event destination bound to one explicit window.

WindowEventEmitter::emit

async fn[Payload : ToJson] WindowEventEmitter::emit(self : WindowEventEmitter, event :
Event
[Payload], payload : Payload) -> Unit

Emits a typed event to this emitter's window.

WindowHandle

pub struct WindowHandle {
id : String
native_id : Int64
show_window : () -> Unit raise WindowSessionError
show_window_inactive : () -> Unit raise WindowSessionError
hide_window : () -> Unit raise WindowSessionError
close_window : () -> Unit raise WindowSessionError
focus_window : () -> Unit raise WindowSessionError
set_window_title : (String) -> Unit raise WindowSessionError
set_window_icon : (String) -> Unit raise WindowSessionError
set_window_parent : (WindowHandle?, Bool) -> Unit raise WindowSessionError
set_window_size : (Int, Int) -> Unit raise WindowSessionError
set_window_content_size : (Int, Int) -> Unit raise WindowSessionError
read_window_content_size : () -> (Int, Int) raise WindowSessionError
minimize_window : () -> Unit raise WindowSessionError
maximize_window : () -> Unit raise WindowSessionError
restore_window : () -> Unit raise WindowSessionError
set_window_fullscreen : (Bool) -> Unit raise WindowSessionError
set_window_kiosk : (Bool) -> Unit raise WindowSessionError
set_window_position : (Int, Int) -> Unit raise WindowSessionError
set_window_always_on_top : (Bool) -> Unit raise WindowSessionError
set_window_resizable : (Bool) -> Unit raise WindowSessionError
set_window_minimum_size : (Int, Int) -> Unit raise WindowSessionError
set_window_maximum_size : (Int, Int) -> Unit raise WindowSessionError
set_window_aspect_ratio : (Double) -> Unit raise WindowSessionError
set_window_movable : (Bool) -> Unit raise WindowSessionError
set_window_opacity : (Double) -> Unit raise WindowSessionError
set_window_skip_taskbar : (Bool) -> Unit raise WindowSessionError
set_window_content_protection : (Bool) -> Unit raise WindowSessionError
set_window_minimizable : (Bool) -> Unit raise WindowSessionError
set_window_maximizable : (Bool) -> Unit raise WindowSessionError
set_window_closable : (Bool) -> Unit raise WindowSessionError
set_window_button_visibility : (Bool) -> Unit raise WindowSessionError
set_window_focusable : (Bool) -> Unit raise WindowSessionError
set_window_fullscreenable : (Bool) -> Unit raise WindowSessionError
set_window_has_shadow : (Bool) -> Unit raise WindowSessionError
set_window_ignore_mouse_events : (Bool, Bool) -> Unit raise WindowSessionError
set_window_background_color : (String) -> Unit raise WindowSessionError
set_window_visible_on_all_workspaces : (Bool) -> Unit raise WindowSessionError
set_window_enabled : (Bool) -> Unit raise WindowSessionError
set_window_menu : (MenuBar?) -> Unit raise WindowSessionError
set_window_zoom_percent : (Int) -> Unit raise WindowSessionError
set_window_progress_bar : (Double) -> Unit raise WindowSessionError
flash_window_frame : (Bool) -> Unit raise WindowSessionError
popup_window_menu : (Menu, Int, Int) -> Unit raise WindowSessionError
read_window_state : () -> WindowState raise WindowSessionError
browser : BrowserHandle
add_view : (String, ViewConfig) -> ViewHandle raise WindowSessionError
remove_view : (String) -> Unit raise WindowSessionError
list_views : () -> Array[ViewHandle]
find_view : (String) -> ViewHandle?
}

A non-owning reference to one concrete window instance.

The instance id prevents a stale handle from targeting a later window that reuses the same declarative id.

WindowHandle::add_view

fn WindowHandle::add_view(self : WindowHandle, id : String, config : ViewConfig) -> ViewHandle raise WindowSessionError

Adds a web contents view to this window, following the Electron WebContentsView model: the view renders its own page above the window's main browser content at explicit bounds. id is unique within the window and lets the session reject stale handles.

WindowHandle::bounds

fn WindowHandle::bounds(self : WindowHandle) -> (Int, Int, Int, Int) raise WindowSessionError

Returns (x, y, width, height) in logical screen pixels, matching Electron's getBounds coordinate order.

WindowHandle::browser

fn WindowHandle::browser(self : WindowHandle) -> BrowserHandle

WindowHandle::center

fn WindowHandle::center(self : WindowHandle) -> Unit raise WindowSessionError

Centers the window in the work area of the monitor containing it.

The current native frame size is preserved. Work-area coordinates exclude taskbars, docks, and other reserved desktop regions, and use Proton's top-left coordinate convention on every platform.

WindowHandle::close

fn WindowHandle::close(self : WindowHandle) -> Unit raise WindowSessionError

WindowHandle::content_size

fn WindowHandle::content_size(self : WindowHandle) -> (Int, Int) raise WindowSessionError

Returns the renderer content area in logical pixels.

WindowHandle::flash_frame

fn WindowHandle::flash_frame(self : WindowHandle, flash : Bool) -> Unit raise WindowSessionError

Starts or stops flashing the window to attract the user's attention.

On macOS, true continuously bounces the application Dock icon until the application becomes active or flash_frame(false) cancels the request. On Windows it flashes the taskbar button until the window becomes active, and on Linux it sets the desktop window urgency hint. Headless runtimes raise WindowSessionError.

WindowHandle::focus

fn WindowHandle::focus(self : WindowHandle) -> Unit raise WindowSessionError

WindowHandle::hide

fn WindowHandle::hide(self : WindowHandle) -> Unit raise WindowSessionError

WindowHandle::id

fn WindowHandle::id(self : WindowHandle) -> String

Returns the declarative id of this window.

WindowHandle::is_focused

fn WindowHandle::is_focused(self : WindowHandle) -> Bool raise WindowSessionError

WindowHandle::is_visible

fn WindowHandle::is_visible(self : WindowHandle) -> Bool raise WindowSessionError

WindowHandle::maximize

fn WindowHandle::maximize(self : WindowHandle) -> Unit raise WindowSessionError

WindowHandle::minimize

fn WindowHandle::minimize(self : WindowHandle) -> Unit raise WindowSessionError

WindowHandle::remove_view

fn WindowHandle::remove_view(self : WindowHandle, id : String) -> Unit raise WindowSessionError

Removes and destroys a web contents view previously added with add_view.

WindowHandle::restore

fn WindowHandle::restore(self : WindowHandle) -> Unit raise WindowSessionError

WindowHandle::set_always_on_top

fn WindowHandle::set_always_on_top(self : WindowHandle, always_on_top : Bool) -> Unit raise WindowSessionError

WindowHandle::set_aspect_ratio

fn WindowHandle::set_aspect_ratio(self : WindowHandle, aspect_ratio : Double) -> Unit raise WindowSessionError

Sets the live native window aspect ratio used while the user resizes it. Pass 0.0 to clear the constraint. Programmatic set_size calls are not constrained by the ratio, matching Electron's setAspectRatio behavior. Headless runtimes raise WindowSessionError.

WindowHandle::set_background_color

fn WindowHandle::set_background_color(self : WindowHandle, color : String) -> Unit raise WindowSessionError

Sets the live native window background color.

Accepts #RRGGBB or #AARRGGBB, matching Proton view configuration.

WindowHandle::set_bounds

fn WindowHandle::set_bounds(self : WindowHandle, x~ : Int, y~ : Int, width~ : Int, height~ : Int) -> Unit raise WindowSessionError

Sets (x, y, width, height) in logical screen pixels, matching Electron's setBounds coordinate order.

WindowHandle::set_closable

fn WindowHandle::set_closable(self : WindowHandle, closable : Bool) -> Unit raise WindowSessionError

Sets whether the user can manually close this live native window.

macOS and Windows update the native close control; programmatic close calls remain available. Linux follows Electron and treats this as a successful no-op. Headless runtimes raise WindowSessionError.

WindowHandle::set_content_protection

fn WindowHandle::set_content_protection(self : WindowHandle, enabled : Bool) -> Unit raise WindowSessionError

Sets whether other applications should be prevented from capturing this live native window.

macOS applies NSWindowSharingNone, although ScreenCaptureKit-based apps on recent macOS releases may still capture the window. Windows uses display affinity to exclude the window from capture. Linux follows Electron and treats this as a no-op. Headless runtimes raise WindowSessionError.

WindowHandle::set_content_size

fn WindowHandle::set_content_size(self : WindowHandle, width : Int, height : Int) -> Unit raise WindowSessionError

Sets the renderer content area in logical pixels.

WindowHandle::set_enabled

fn WindowHandle::set_enabled(self : WindowHandle, enabled : Bool) -> Unit raise WindowSessionError

Enables or disables user interaction with the live native window.

WindowHandle::set_focusable

fn WindowHandle::set_focusable(self : WindowHandle, focusable : Bool) -> Unit raise WindowSessionError

Sets whether this live native window can receive focus.

macOS and Windows update the native window behavior. On macOS, disabling focus does not remove focus from a window that is already focused, matching Electron. Linux follows Electron and treats this as a successful no-op. Headless runtimes raise WindowSessionError.

WindowHandle::set_fullscreen

fn WindowHandle::set_fullscreen(self : WindowHandle, fullscreen : Bool) -> Unit raise WindowSessionError

WindowHandle::set_fullscreenable

fn WindowHandle::set_fullscreenable(self : WindowHandle, fullscreenable : Bool) -> Unit raise WindowSessionError

Sets whether this live native window can enter fullscreen mode.

When disabled, attempts to enter fullscreen are ignored. An already fullscreen window can still exit fullscreen.

WindowHandle::set_has_shadow

fn WindowHandle::set_has_shadow(self : WindowHandle, has_shadow : Bool) -> Unit raise WindowSessionError

Sets whether this live native window draws a frame shadow.

macOS applies this directly to the native window. Linux and Windows accept the setting as a successful no-op when the platform frame owns the shadow. Headless runtimes raise WindowSessionError.

WindowHandle::set_icon

fn WindowHandle::set_icon(self : WindowHandle, path : String) -> Unit raise WindowSessionError

Sets the native window icon from an image file path.

WindowHandle::set_ignore_mouse_events

fn WindowHandle::set_ignore_mouse_events(self : WindowHandle, ignore : Bool, forward : Bool) -> Unit raise WindowSessionError

Sets whether this live native window ignores mouse events.

When ignore is true, mouse input passes through to the window below while keyboard input remains available to the focused window. forward requests mouse-move forwarding to Chromium where the platform supports it. Forwarding is disabled automatically when ignore is false.

WindowHandle::set_kiosk

fn WindowHandle::set_kiosk(self : WindowHandle, kiosk : Bool) -> Unit raise WindowSessionError

Enters or leaves kiosk mode.

Kiosk uses the full display and hides system chrome where the platform supports it. Call with false to provide a programmatic exit path.

WindowHandle::set_maximizable

fn WindowHandle::set_maximizable(self : WindowHandle, maximizable : Bool) -> Unit raise WindowSessionError

Sets whether the user can manually maximize this live native window. macOS and Windows update the native maximize/zoom control; Linux follows Electron and treats this as a successful no-op. Headless runtimes raise WindowSessionError.

WindowHandle::set_maximum_size

fn WindowHandle::set_maximum_size(self : WindowHandle, width : Int, height : Int) -> Unit raise WindowSessionError

Sets the maximum live native window size.

Both dimensions must be positive, or both must be zero to clear the constraint. Existing minimum size and resizable state remain unchanged. Headless runtimes raise WindowSessionError.

WindowHandle::set_menu

fn WindowHandle::set_menu(self : WindowHandle, menu : MenuBar?) -> Unit raise WindowSessionError

Replaces the native menu for the application runtime containing this window. Passing None clears the menu.

WindowHandle::set_minimizable

fn WindowHandle::set_minimizable(self : WindowHandle, minimizable : Bool) -> Unit raise WindowSessionError

Sets whether the user can manually minimize this live native window. macOS and Windows update the native minimize control; Linux follows Electron and treats this as a successful no-op. Headless runtimes raise WindowSessionError.

WindowHandle::set_minimum_size

fn WindowHandle::set_minimum_size(self : WindowHandle, width : Int, height : Int) -> Unit raise WindowSessionError

Sets the minimum live native window size.

Both dimensions must be positive, or both must be zero to clear the constraint. Existing maximum size and resizable state remain unchanged. Headless runtimes raise WindowSessionError.

WindowHandle::set_movable

fn WindowHandle::set_movable(self : WindowHandle, movable : Bool) -> Unit raise WindowSessionError

Sets whether the user can move this live native window.

macOS and Windows prevent manual frame movement when movable is false; programmatic set_position and center calls remain available. Linux follows Electron and treats this as a no-op. Headless runtimes raise WindowSessionError because they have no native frame.

WindowHandle::set_opacity

fn WindowHandle::set_opacity(self : WindowHandle, opacity : Double) -> Unit raise WindowSessionError

Sets the live native window opacity.

Values are clamped to the Electron-compatible 0.0..1.0 range, where 0.0 is fully transparent and 1.0 is fully opaque. Headless runtimes raise WindowSessionError because they have no native frame.

WindowHandle::set_parent

fn WindowHandle::set_parent(self : WindowHandle, parent : WindowHandle?, modal? : Bool) -> Unit raise WindowSessionError

Establishes or clears this window's native parent relationship.

WindowHandle::set_position

fn WindowHandle::set_position(self : WindowHandle, x : Int, y : Int) -> Unit raise WindowSessionError

WindowHandle::set_progress_bar

fn WindowHandle::set_progress_bar(self : WindowHandle, progress : Double) -> Unit raise WindowSessionError

Sets the platform progress indicator using Electron-compatible values.

Pass a negative value to clear the indicator, a value from 0.0 through 1.0 for determinate progress, or a value above 1.0 for indeterminate progress. The current native implementation displays this in the macOS Dock as one application-level indicator; the most recent window call wins, and any negative value clears it. Unsupported platforms raise WindowSessionError.

WindowHandle::set_resizable

fn WindowHandle::set_resizable(self : WindowHandle, resizable : Bool) -> Unit raise WindowSessionError

Sets whether the user can manually resize this window.

This changes the live native window on macOS, Windows, and Linux. Existing minimum or maximum size hints remain in effect. Headless runtimes raise WindowSessionError.

WindowHandle::set_size

fn WindowHandle::set_size(self : WindowHandle, width : Int, height : Int) -> Unit raise WindowSessionError

WindowHandle::set_skip_taskbar

fn WindowHandle::set_skip_taskbar(self : WindowHandle, skip : Bool) -> Unit raise WindowSessionError

Sets whether this live native window is omitted from the taskbar or dock.

Windows removes or restores the taskbar tab. macOS and Linux follow Electron and treat this as a no-op. Headless runtimes raise WindowSessionError because they have no native window shell.

WindowHandle::set_title

fn WindowHandle::set_title(self : WindowHandle, title : String) -> Unit raise WindowSessionError

WindowHandle::set_visible_on_all_workspaces

fn WindowHandle::set_visible_on_all_workspaces(self : WindowHandle, visible : Bool) -> Unit raise WindowSessionError

Sets whether the live window appears on every workspace.

This maps to Spaces on macOS and sticky windows on Linux. It is a successful no-op on Windows, matching Electron.

WindowHandle::set_window_button_visibility

fn WindowHandle::set_window_button_visibility(self : WindowHandle, visible : Bool) -> Unit raise WindowSessionError

Sets visibility of the standard close, minimize, and maximize buttons. On macOS this updates the native traffic-light controls. Other platforms apply the equivalent live capability controls where available.

WindowHandle::set_zoom_percent

fn WindowHandle::set_zoom_percent(self : WindowHandle, zoom_percent : Int) -> Unit raise WindowSessionError

WindowHandle::show

fn WindowHandle::show(self : WindowHandle) -> Unit raise WindowSessionError

WindowHandle::show_inactive

fn WindowHandle::show_inactive(self : WindowHandle) -> Unit raise WindowSessionError

Shows the window without activating it.

WindowHandle::state

WindowHandle::view

fn WindowHandle::view(self : WindowHandle, id : String) -> ViewHandle?

Returns the live view with the given declarative id, if one exists.

WindowHandle::views

Lists the live web contents views of this window.

WindowHandle::zoom_percent

fn WindowHandle::zoom_percent(self : WindowHandle) -> Int raise WindowSessionError

Returns the main browser zoom percentage.

WindowManager

pub struct WindowManager {
open_window : async (String) -> WindowHandle raise WindowSessionError
find_window : (String) -> WindowHandle?
}

Opens and locates windows declared by the application manifest.

WindowManager::find

fn WindowManager::find(self : WindowManager, id : String) -> WindowHandle?

Returns the active instance for a declared window id.

WindowManager::open

async fn WindowManager::open(self : WindowManager, id : String) -> WindowHandle raise WindowSessionError

Opens one declared window that is not currently active.

WindowMonitor

pub(all) struct WindowMonitor {
x : Int
y : Int
width : Int
height : Int
work_x : Int
work_y : Int
work_width : Int
work_height : Int
scale_factor_percent : Int
} derive(Eq,
Debug
)

Geometry and scaling information for the monitor containing a window.

WindowMonitor::equal

WindowMonitor::not_equal

fn WindowMonitor::not_equal(x : WindowMonitor, y : WindowMonitor) -> Bool

WindowSizeHint

pub(all) enum WindowSizeHint {
Unconstrained
Fixed
Min
Max
} derive(Eq,
Debug
)

Controls how configured window dimensions constrain native resizing.

WindowSizeHint::equal

WindowSizeHint::not_equal

fn WindowSizeHint::not_equal(x : WindowSizeHint, y : WindowSizeHint) -> Bool

WindowState

pub(all) struct WindowState {
x : Int
y : Int
width : Int
height : Int
monitor : WindowMonitor
zoom_percent : Int
visible : Bool
focused : Bool
minimized : Bool
maximized : Bool
fullscreen : Bool
always_on_top : Bool
theme : String
} derive(Eq,
Debug
)

A point-in-time snapshot of a native window.

WindowState::equal

fn WindowState::equal(WindowState, WindowState) -> Bool

WindowState::not_equal

fn WindowState::not_equal(x : WindowState, y : WindowState) -> Bool

app_path

fn app_path() -> String

Returns the application resource root, corresponding to Electron's app.getAppPath().

asset

fn asset(title : String, path : String, width? : Int, height? : Int, debug? : Bool, resizable? : Bool) -> App

Creates an inline asset application.

check_for_update

async fn check_for_update() -> UpdateCheck

Asks the configured channel whether a newer release is on offer.

Available to the application at any time, not only at launch. Returns NotConfigured rather than UpToDate when there is no channel, because "nobody told us where to look" and "we looked and found nothing" are different answers and only one of them is worth showing a user.

file

fn file(title : String, path : String, width? : Int, height? : Int, debug? : Bool, resizable? : Bool) -> App

Creates an inline file application.

html

fn html(title : String, html : String, width? : Int, height? : Int, debug? : Bool, resizable? : Bool) -> App

Creates an inline HTML application.

is_packaged

fn is_packaged() -> Bool

Returns whether this process is running from a Proton package.

resource_dir

fn resource_dir() -> String

Resolves the absolute application resource directory.

proton_cli dev supplies the project resource directory explicitly. A packaged application resolves the package resource directory beside its executable. Directly launched code uses the current working directory.

screens

fn screens() -> Array[ScreenInfo] raise ScreenQueryError

Returns information about the displays currently visible to the app.

system_preferred_languages

Returns the operating system's valid preferred languages in preference order. Invalid platform entries are ignored.

url

fn url(title : String, url : String, width? : Int, height? : Int, debug? : Bool, resizable? : Bool) -> App

Creates an inline URL application.

view

fn view(url : String, width~ : Int, height~ : Int, x? : Int, y? : Int, visible? : Bool, z_order? : Int, background_color? : String) -> ViewConfig

Creates a web contents view configuration for WindowHandle::add_view, following the Electron new WebContentsView(options) model: the view renders url inside its owning window's content area at explicit top-left bounds, stacked above the window's main page.