DesktopWindowHostOptions record

Namespace Runic.Desktop in Runic.Desktop 0.23.0

public sealed record DesktopWindowHostOptions : IEquatable<DesktopWindowHostOptions>

Inherits or implements IEquatable.

Describes the immutable initial state of an embedded window host.

Remarks

Runic Desktop derives these values from DesktopWindowOptions.

Constructors

DesktopWindowHostOptions

public DesktopWindowHostOptions()

No documentation.

Properties

AdditionalOrigins

public IReadOnlyList<Uri> AdditionalOrigins { get; init; }

Gets the application's origins besides the presented URL's: the surface's own origin and its DesktopSecurityPolicy.AdditionalOrigins.

AllowedPermissions

public DesktopPermissionGrant AllowedPermissions { get; init; }

Gets the sensitive permissions the host may grant, only to the origin of the presented URL.

BrowserArguments

public string? BrowserArguments { get; init; }

Gets additional WebView command-line arguments as one unsplit string: DesktopWindowOptions.BrowserArguments.

Centered

public bool Centered { get; init; }

Gets whether the window opens centered on the screen.

CloseRequested

public Action? CloseRequested { get; init; }

When set, suppress user close requests and invoke this callback. CloseAsync must bypass it.

ColorScheme

public DesktopColorScheme ColorScheme { get; init; }

Gets the light or dark appearance of the window and its page, from DesktopWindowOptions.ColorScheme; DesktopColorScheme.NoPreference follows the system.

Remarks

A host that applies it sets the page's prefers-color-scheme and, where it can, its window's appearance. A host that cannot reports color-scheme-unsupported from IDesktopWindowHostFactory.ValidateOptions.

DiagnosticSink

public Action<DesktopDiagnostic>? DiagnosticSink { get; init; }

Gets the callback that reports an event of the open window, such as a crashed web process, to DesktopHostOptions.DiagnosticSink and the Desktop logger (event 3010). The host may call it on any thread, including the window's own; a sink that throws is logged, not rethrown.

DocumentStartScript

public string? DocumentStartScript { get; init; }

Gets the script a host reporting IDesktopWindowHost.SupportsDocumentStartScript must add before its first navigation. It carries session credentials: do not log, persist, or expose it to page content.

EphemeralDataStore

public string? EphemeralDataStore { get; init; }

Gets the key of the data store that is not persisted this window uses, or null, the default, for the host's usual data store.

Remarks

Runic Desktop sets it for the windows of a hosted application (the Runic host protocol, runic-host/1): their cookies, storage and caches must stay in memory, shared by the windows of the same key and by no other window, so the hosted application's server never receives the host application's cookies and two hosted applications never share storage. Runic Desktop gives a key only to a host that implements IDesktopEphemeralDataStoreWindowHost; a hosted window fails to open on any other. Experimental with the rest of the protocol; see docs/experimental.md.

Frameless

public bool Frameless { get; init; }

Gets whether the window opens without a title bar and border.

public bool GlobalMenu { get; init; }

Gets whether a DesktopMenuBarPresentation.Native bar may go into the Linux desktop's global menu, from LinuxDesktopOptions.GlobalMenu; true by default.

Remarks

A Linux host implementing IDesktopMenuWindowHost that can export its bar applies it and reports DesktopMenuBarPlacement.Global while the global menu shows the bar; others ignore it.

Height

public int Height { get; init; }

Gets the initial window height in pixels. Defaults to 600.

Hidden

public bool Hidden { get; init; }

Gets whether the window is created without being shown.

HighContrast

public bool HighContrast { get; init; }

Gets whether the presentation uses a high-contrast theme, already resolved from the system setting when unset.

IconFile

public string? IconFile { get; init; }

Gets the path of the window icon file, or null for the default icon.

Kiosk

public bool Kiosk { get; init; }

Gets whether the window opens full-screen without decorations.

Language

public string? Language { get; init; }

Gets the BCP 47 language of the web view's own text, from DesktopWindowOptions.Language, or null.

LayoutDirection

public DesktopLayoutDirection LayoutDirection { get; init; }

Gets the direction of the window's native parts, from DesktopWindowOptions.LayoutDirection.

public DesktopMenuBarPresentation MenuBarPresentation { get; init; }

Gets where the window shows the menu bar, from DesktopWindowOptions.MenuBarPresentation.

Remarks

A host implementing IDesktopMenuWindowHost applies it; others ignore it.

MinimumHeight

public int? MinimumHeight { get; init; }

Gets the minimum window height in pixels, or null for no minimum.

MinimumWidth

public int? MinimumWidth { get; init; }

Gets the minimum window width in pixels, or null for no minimum.

Modality

public DesktopWindowModality Modality { get; init; }

Gets whether the window blocks its owner, from DesktopWindowOptions.Modality.

Remarks

With DesktopWindowModality.Window, a host reporting DesktopWindowCapabilities.Ownership makes the owner take no input, and ignore the user's close, while the window is shown (a hidden one does not block it), and leaves the application's other windows usable. Several windows may be modal to one owner at once: the owner takes input again when the last of them closed. It is DesktopWindowModality.None when DesktopWindowHostOptions.OwnerHandle is zero.

MonitorId

public string? MonitorId { get; init; }

Gets the monitor to open on, from DesktopWindowOptions.MonitorId; null when a placement's position or the platform decides.

Remarks

A host implementing IDesktopPlacementWindowHost applies it; others ignore it.

OwnerHandle

public nint OwnerHandle { get; init; }

Gets the native handle of the window that owns this one, from DesktopWindowOptions.Owner, or zero for a window of its own. It is the kind IDesktopWindowHost.NativeHandle reports, such as a GtkWindow*.

Remarks

A host reporting DesktopWindowCapabilities.Ownership keeps the window above its owner, as a toolkit's transient or owned window does. Use the handle only on the window's UI thread, and only while opening and closing the window. Runic Desktop passes zero to a host without the capability.

Placement

public DesktopWindowPlacement? Placement { get; init; }

Gets the saved placement the window restores, from DesktopWindowOptions.Placement, or null. DesktopWindowHostOptions.Width, DesktopWindowHostOptions.Height, DesktopWindowHostOptions.X and DesktopWindowHostOptions.Y already hold its values.

Remarks

A host reporting DesktopWindowCapabilities.State keeps the restored window inside one of the current monitors' work areas, shrinking it to fit, and opens it maximized when DesktopWindowPlacement.Maximized is set and DesktopWindowHostOptions.Kiosk is not.

ProfilePath

public string? ProfilePath { get; init; }

Gets the WebView profile or user-data directory, or null for the host's default.

Resizable

public bool Resizable { get; init; }

Gets whether the user can resize the window. Defaults to true.

SpellChecking

public bool SpellChecking { get; init; }

Gets whether the page's fields are spell-checked, from DesktopWindowOptions.SpellChecking; true by default.

Remarks

Runic Desktop applies false through DesktopWindowHostOptions.DocumentStartScript, which then sets spellcheck="false" on every document's root element, so a host that runs that script need do nothing more. A host with a spell checker that is off until it is turned on, such as WebKitGTK's, turns it on.

SpellCheckingLanguages

public IReadOnlyList<string> SpellCheckingLanguages { get; init; }

Gets the BCP 47 languages the spell checker checks, from DesktopHost.SpellCheckingLanguages; empty for the user's languages.

Remarks

A host implementing IDesktopSpellCheckingWindowHost applies them; others ignore them.

Transparent

public bool Transparent { get; init; }

Gets whether the window has a transparent background where the page does not paint.

WebContent

public DesktopWebContentPolicy WebContent { get; init; }

Gets what the window does with navigation away from the application, new windows, downloads and developer tools (DesktopWindowOptions.WebContent). Runic Desktop resolves the Development default, so DesktopWebContentPolicy.DevTools is never null here.

Remarks

A host that can intercept them applies it to top-level navigations, new-window requests and downloads: the application's origins are the presented URL's origin and DesktopWindowHostOptions.AdditionalOrigins.

Width

public int Width { get; init; }

Gets the initial window width in pixels. Defaults to 800.

X

public int? X { get; init; }

Gets the initial horizontal screen position in pixels, or null to let the platform choose.

Y

public int? Y { get; init; }

Gets the initial vertical screen position in pixels, or null to let the platform choose.