# Kurogane

> A composable Chromium runtime for Rust. Kurogane embeds Chromium in your application through CEF and leaves your application in charge of its event loop, windows and lifecycle.

These are the docs of Kurogane 0.0.6-beta.1. Every link leads to the Markdown copy of a page. [llms-full.txt](https://kurogane-rs.org/llms-full.txt) holds all of them in one file.

## Start

- [Introduction](https://kurogane-rs.org/docs/start/introduction.md): What Kurogane is, what it's for and when another tool fits better.
- [Install](https://kurogane-rs.org/docs/start/install.md): Install the kurogane CLI and the tools your apps build with.
- [First app](https://kurogane-rs.org/docs/start/first-app.md): Create a project, run it, call Rust from the page and bundle it.
- [Project layout](https://kurogane-rs.org/docs/start/project-layout.md): What each file in a Kurogane project does and how kurogane.toml ties them together.

## Concepts

- [Process model](https://kurogane-rs.org/docs/concepts/process-model.md): Which processes a Kurogane app runs and which of your code runs in each.
- [Runtime and event loop](https://kurogane-rs.org/docs/concepts/runtime-and-event-loop.md): Who drives Chromium's message loop and who owns the windows.
- [Windows and browsers](https://kurogane-rs.org/docs/concepts/windows-and-browsers.md): What a window and a browser are, who opens them and how your app reaches them.
- [Lifecycle and shutdown](https://kurogane-rs.org/docs/concepts/lifecycle-and-shutdown.md): How a browser closes, when your app ends and how Chromium shuts down.
- [app:// and your frontend](https://kurogane-rs.org/docs/concepts/app-protocol.md): Where your app's page comes from and how Kurogane serves it from disk.
- [IPC](https://kurogane-rs.org/docs/concepts/ipc.md): Commands, events and streams between your Rust code and your page.
- [Capabilities and permissions](https://kurogane-rs.org/docs/concepts/capabilities-and-permissions.md): What a page may reach and who decides it.
- [Sandbox](https://kurogane-rs.org/docs/concepts/sandbox.md): Run Chromium's helper processes in the operating system's sandbox.

## Guides

- [Load a dev server or bundled assets](https://kurogane-rs.org/docs/guides/frontend-source.md): Point your app at a dev server during development and at its built frontend in release builds.
- [Open windows and remember their placement](https://kurogane-rs.org/docs/guides/windows.md): Shape the start window, open more windows and reopen each where the user left it.
- [Control links, popups and navigation](https://kurogane-rs.org/docs/guides/links-and-navigation.md): Decide which windows a page may open and where it may take its window.
- [Keyboard shortcuts and Chromium commands](https://kurogane-rs.org/docs/guides/keyboard-shortcuts.md): Decide which keys your app takes, which the page gets and which of Chromium's commands run.
- [Downloads](https://kurogane-rs.org/docs/guides/downloads.md): Decide where the files a page downloads are saved.
- [Permissions](https://kurogane-rs.org/docs/guides/permissions.md): Allow a camera, a microphone, the location and Chromium's other permissions, or ask the user first.
- [The context menu](https://kurogane-rs.org/docs/guides/context-menu.md): Edit the menu a right-click opens, add items of your own or let the page draw its own.
- [File choosers](https://kurogane-rs.org/docs/guides/file-choosers.md): Answer the file choosers a page opens with the system's dialog, files of your choosing or a picker of your own.
- [Drags into embedded browsers](https://kurogane-rs.org/docs/guides/drags.md): Decide what another application may drag into a browser embedded in your own window.
- [Follow the page's title and fullscreen](https://kurogane-rs.org/docs/guides/title-and-fullscreen.md): Keep a window's title and fullscreen state in step with its page and hear when they change.
- [One instance per profile](https://kurogane-rs.org/docs/guides/single-instance.md): Handle a second launch in the running app, run separate copies and choose where the profile lives.
- [Commands in depth](https://kurogane-rs.org/docs/guides/commands.md): Synchronous, async and binary commands, their errors and how much data they carry.
- [Events](https://kurogane-rs.org/docs/guides/events.md): Send named messages from your Rust code to every page subscribed to them.
- [Streams](https://kurogane-rs.org/docs/guides/streams.md): Move chunks both ways between a page and a Rust handler until one side ends.
- [WebAssembly](https://kurogane-rs.org/docs/guides/webassembly.md): Build a WebAssembly module and load it in your page.
- [GPU mode](https://kurogane-rs.org/docs/guides/gpu-mode.md): Choose how Chromium renders your page and check what the GPU does on a machine.
- [Credential storage](https://kurogane-rs.org/docs/guides/credential-storage.md): Choose how Chromium protects cookies and saved passwords at rest and stop Keychain prompts.
- [Chromium flags and preferences](https://kurogane-rs.org/docs/guides/chromium-flags.md): Pass Chromium switches, set its preferences and turn back on what Kurogane turns off.
- [Logging](https://kurogane-rs.org/docs/guides/logging.md): See what Kurogane and Chromium do and read the errors your app reports when it can't start.
- [Browser and renderer delegates](https://kurogane-rs.org/docs/guides/delegates.md): Take part in Chromium's browser and renderer process lifecycles without replacing Kurogane's own.

## Embedding

- [Drive Chromium from winit](https://kurogane-rs.org/docs/embedding/winit.md): Run Kurogane's windows from a winit event loop and pump Chromium when it asks.
- [Embed a browser in your window](https://kurogane-rs.org/docs/embedding/child-browsers.md): Place Chromium browsers inside windows your app owns, keep them laid out and close them cleanly.

## Shipping

- [Bundle your app](https://kurogane-rs.org/docs/shipping/bundling.md): Package your app with its frontend and the Chromium runtime for Linux, Windows and macOS.
- [Bundle layouts](https://kurogane-rs.org/docs/shipping/bundle-layouts.md): What each bundle format holds, how a bundled app finds its Chromium and how that runtime is verified.
- [Code signing](https://kurogane-rs.org/docs/shipping/signing.md): Sign your Windows binaries and installer or your macOS app as part of kurogane bundle.
- [Platforms and requirements](https://kurogane-rs.org/docs/shipping/platforms.md): What each platform needs and what behaves differently on Linux, Windows, macOS and Nix.
- [Templates](https://kurogane-rs.org/docs/shipping/templates.md): Start projects from the official starters or a template of your own. Write templates others can use.

## CLI and manifest

- [CLI reference](https://kurogane-rs.org/docs/cli.md): every command of the kurogane CLI 0.0.6-beta.1
- [Manifest reference](https://kurogane-rs.org/docs/manifest.md): every table and key of kurogane.toml

## API reference

- [API reference](https://kurogane-rs.org/docs/api.md): every public item of the kurogane crate, grouped by topic

### App and runtime

- [App and runtime](https://kurogane-rs.org/docs/api/app.md): Configures an application, starts the runtime and reaches it once it runs.
- [`App`](https://kurogane-rs.org/docs/api/app/app.md): Public application builder.
- [`AppHandle`](https://kurogane-rs.org/docs/api/app/apphandle.md): Shared lifecycle handle for a running Kurogane application.
- [`AppInstance`](https://kurogane-rs.org/docs/api/app/appinstance.md): The running application, owned by the thread that started it.
- [`BrowserBounds`](https://kurogane-rs.org/docs/api/app/browserbounds.md): A browser's place inside its parent window, for `AppInstance::create_child_browser` and `BrowserHandle::set_bounds`. It is a position and a size in that window's own coordinates, which CEF applies unconverted. Pixels from the top-left of the client area on Windows and X11; on macOS, points in the parent `NSView`, whose origin is its top-left corner when the view is flipped (winit's is) and its bottom-left corner otherwise.
- [`BrowserHandle`](https://kurogane-rs.org/docs/api/app/browserhandle.md): A browser of the running application.
- [`SecondInstance`](https://kurogane-rs.org/docs/api/app/secondinstance.md): A launch of the application while another instance is already running.
- [`CefLocation`](https://kurogane-rs.org/docs/api/app/ceflocation.md): Where the application found its Chromium runtime, in the order it looks.
- [`ConfigError`](https://kurogane-rs.org/docs/api/app/configerror.md): One problem in the [`App`](/docs/api/app/app) builder configuration, reported by `build()` / `run()` / `start_embedded()` as `RuntimeError::InvalidConfiguration`.
- [`CredentialStorage`](https://kurogane-rs.org/docs/api/app/credentialstorage.md): Backend used to protect cookies and saved passwords at rest.
- [`GpuMode`](https://kurogane-rs.org/docs/api/app/gpumode.md): GPU backend selection strategy.
- [`PumpRequest`](https://kurogane-rs.org/docs/api/app/pumprequest.md): A request from CEF indicating when it next needs to be serviced.
- [`RuntimeError`](https://kurogane-rs.org/docs/api/app/runtimeerror.md): Failure to start the application or to open a window or a browser.
- [`SandboxMode`](https://kurogane-rs.org/docs/api/app/sandboxmode.md): Chromium process sandbox policy.
- [`ClientAppBrowserDelegate`](https://kurogane-rs.org/docs/api/app/clientappbrowserdelegate.md): Customizes browser-process startup behavior.
- [`ClientAppRendererDelegate`](https://kurogane-rs.org/docs/api/app/clientapprendererdelegate.md): Customizes render-process behavior.
- [`SchemeHandler`](https://kurogane-rs.org/docs/api/app/schemehandler.md): Generates a `ResourceHandler` for requests on a custom scheme.
- [`is_browser_process`](https://kurogane-rs.org/docs/api/app/is_browser_process.md): Returns whether this process is Chromium's browser process rather than one of its helper processes (renderer, GPU, utility) which run this same binary again with a `--type=` argument.
- [`resource_dir`](https://kurogane-rs.org/docs/api/app/resource_dir.md): The directory a packaged application's bundled resources live in.
- [`resource_handler_from_bytes`](https://kurogane-rs.org/docs/api/app/resource_handler_from_bytes.md): Builds a `ResourceHandler` serving `data` once with the given MIME type and status code.
- [`sandbox_entry`](https://kurogane-rs.org/docs/api/app/sandbox_entry.md): Declares the entry points CEF's sandbox bootstrap calls.

### Windows and browsers

- [Windows and browsers](https://kurogane-rs.org/docs/api/windows.md): Opens windows, places them and names the browsers inside them.
- [`BrowserId`](https://kurogane-rs.org/docs/api/windows/browserid.md): Identifier of a browser, never reused while the application runs.
- [`BrowserMetadata`](https://kurogane-rs.org/docs/api/windows/browsermetadata.md): What the runtime knows about an open browser, from [`AppHandle::browsers`](/docs/api/app/apphandle#method.browsers).
- [`FullscreenChange`](https://kurogane-rs.org/docs/api/windows/fullscreenchange.md): A page entering or leaving fullscreen, passed to [`App::on_fullscreen_change`](/docs/api/app/app#method.on_fullscreen_change).
- [`TitleChange`](https://kurogane-rs.org/docs/api/windows/titlechange.md): A page's new title, passed to [`App::on_title_change`](/docs/api/app/app#method.on_title_change).
- [`WindowClosing`](https://kurogane-rs.org/docs/api/windows/windowclosing.md): A window of the application's closing, passed to [`App::on_window_closing`](/docs/api/app/app#method.on_window_closing). It says which window it is and where it was, to open it there again with [`WindowOptions::placement`](/docs/api/windows/windowoptions#method.placement).
- [`WindowId`](https://kurogane-rs.org/docs/api/windows/windowid.md): Identifier of a window, never reused while the application runs.
- [`WindowMetadata`](https://kurogane-rs.org/docs/api/windows/windowmetadata.md): What the runtime knows about an open window, from [`AppHandle::windows`](/docs/api/app/apphandle#method.windows).
- [`WindowOptions`](https://kurogane-rs.org/docs/api/windows/windowoptions.md): How an application window opens. It holds the name the application knows it by, its title, size and place, the size it cannot be made smaller than and its state.
- [`WindowPlacement`](https://kurogane-rs.org/docs/api/windows/windowplacement.md): Where a window's content is on the screen in density-independent pixels and how the window shows. A window maximized, minimized or fullscreen is placed where it restores to.
- [`BrowserType`](https://kurogane-rs.org/docs/api/windows/browsertype.md): Kind of a browser.
- [`WindowState`](https://kurogane-rs.org/docs/api/windows/windowstate.md): How a window shows when it opens (as its options say) and as it closes.

### IPC

- [IPC](https://kurogane-rs.org/docs/api/ipc.md): Commands, streams and errors between your Rust code and the page.
- [`IpcError`](https://kurogane-rs.org/docs/api/ipc/ipcerror.md): A structured error with a numeric `ErrorCode` and human-readable message.
- [`Origin`](https://kurogane-rs.org/docs/api/ipc/origin.md): Security origin of a frame as `scheme://host:port` or opaque.
- [`OriginError`](https://kurogane-rs.org/docs/api/ipc/originerror.md): A configured origin that does not parse.
- [`Responder`](https://kurogane-rs.org/docs/api/ipc/responder.md): The answer to one async request.
- [`StreamResponder`](https://kurogane-rs.org/docs/api/ipc/streamresponder.md): Responder for sending data from a browser-side stream handler to the renderer.
- [`ErrorCode`](https://kurogane-rs.org/docs/api/ipc/errorcode.md): Classifies an `IpcError` by the numeric code exposed to the renderer. Runtime errors use the fixed codes `0` through `-9`; applications may use positive codes through `ErrorCode::App`.
- [`StreamHandler`](https://kurogane-rs.org/docs/api/ipc/streamhandler.md): Handles one stream a page opens.
- [`BinaryResponder`](https://kurogane-rs.org/docs/api/ipc/binaryresponder.md): Responder of an async binary command, resolved with the reply's bytes ([`App::async_binary_command`](/docs/api/app/app#method.async_binary_command)).

### Capabilities

- [Capabilities](https://kurogane-rs.org/docs/api/capabilities.md): Grants a page scoped access to the filesystem.
- [`AuthorizedFs`](https://kurogane-rs.org/docs/api/capabilities/authorizedfs.md): The authority of one origin. Every operation runs the decision rules in the module documentation; nothing else reaches the filesystem for a renderer.
- [`DirEntry`](https://kurogane-rs.org/docs/api/capabilities/direntry.md): One entry of a listed directory. Links and reparse points are never listed.
- [`Filesystem`](https://kurogane-rs.org/docs/api/capabilities/filesystem.md): Filesystem capability configuration of named scopes and the grants that bind origins to them.
- [`FilesystemBuilder`](https://kurogane-rs.org/docs/api/capabilities/filesystembuilder.md): Builder for `Filesystem`.
- [`FsAccess`](https://kurogane-rs.org/docs/api/capabilities/fsaccess.md): A set of operational filesystem capabilities.
- [`ScopeBuilder`](https://kurogane-rs.org/docs/api/capabilities/scopebuilder.md): Declares one scope inside [`FilesystemBuilder::scope`](/docs/api/capabilities/filesystembuilder#method.scope).
- [`ScopeId`](https://kurogane-rs.org/docs/api/capabilities/scopeid.md): Handle to a scope declared on a `FilesystemBuilder`. Grants name scopes by handle. A grant cannot reference a scope that was never declared.
- [`Denial`](https://kurogane-rs.org/docs/api/capabilities/denial.md): Why an in-grant request was refused. Each variant renders one fixed, class-level message.
- [`EntryKind`](https://kurogane-rs.org/docs/api/capabilities/entrykind.md): The kind of a directory entry.
- [`FsConfigError`](https://kurogane-rs.org/docs/api/capabilities/fsconfigerror.md): A `Filesystem` configuration that cannot be built. These are developer-facing and may name paths; they never reach a renderer.
- [`FsError`](https://kurogane-rs.org/docs/api/capabilities/fserror.md): Failure of one filesystem operation performed for an origin.

### Requests and decisions

- [Requests and decisions](https://kurogane-rs.org/docs/api/requests.md): What a page or Chromium asks of your application and the answers it can give.
- [`AppItem`](https://kurogane-rs.org/docs/api/requests/appitem.md): An item of the application's in a `ContextMenu`.
- [`ChromeCommandRequest`](https://kurogane-rs.org/docs/api/requests/chromecommandrequest.md): A command about to run, passed to [`App::on_chrome_command`](/docs/api/app/app#method.on_chrome_command).
- [`ContextMenu`](https://kurogane-rs.org/docs/api/requests/contextmenu.md): The menu a right-click opens, passed to [`App::on_context_menu`](/docs/api/app/app#method.on_context_menu) to edit.
- [`ContextMenuCommand`](https://kurogane-rs.org/docs/api/requests/contextmenucommand.md): An item of the application's chosen, passed to [`App::on_context_menu_command`](/docs/api/app/app#method.on_context_menu_command).
- [`ContextMenuTarget`](https://kurogane-rs.org/docs/api/requests/contextmenutarget.md): What a right-click was on.
- [`DownloadRequest`](https://kurogane-rs.org/docs/api/requests/downloadrequest.md): A download about to start, passed to [`App::on_download`](/docs/api/app/app#method.on_download).
- [`DragEnter`](https://kurogane-rs.org/docs/api/requests/dragenter.md): A drag entering a window, passed to [`App::on_drag_enter`](/docs/api/app/app#method.on_drag_enter).
- [`FileDialogRequest`](https://kurogane-rs.org/docs/api/requests/filedialogrequest.md): A page opening a file chooser, passed to [`App::on_file_dialog`](/docs/api/app/app#method.on_file_dialog).
- [`FileDialogResponder`](https://kurogane-rs.org/docs/api/requests/filedialogresponder.md): Answers a `FileDialogRequest` the hook left for later (`FileDialogDecision::Later`), from any thread.
- [`KeyPress`](https://kurogane-rs.org/docs/api/requests/keypress.md): A key the user pressed, passed to [`App::on_key`](/docs/api/app/app#method.on_key).
- [`Modifiers`](https://kurogane-rs.org/docs/api/requests/modifiers.md): The modifier keys held with a key.
- [`NavigationRequest`](https://kurogane-rs.org/docs/api/requests/navigationrequest.md): A page's navigation of the window it is in, passed to [`App::on_navigation`](/docs/api/app/app#method.on_navigation).
- [`NewWindowRequest`](https://kurogane-rs.org/docs/api/requests/newwindowrequest.md): A page's request for a new window, passed to [`App::on_new_window`](/docs/api/app/app#method.on_new_window).
- [`PermissionRequest`](https://kurogane-rs.org/docs/api/requests/permissionrequest.md): A page asking for a device or a permission, passed to [`App::on_permission`](/docs/api/app/app#method.on_permission).
- [`PermissionResponder`](https://kurogane-rs.org/docs/api/requests/permissionresponder.md): Answers a `PermissionRequest` the hook left for later (`PermissionDecision::Later`), from any thread.
- [`Submenu`](https://kurogane-rs.org/docs/api/requests/submenu.md): A submenu of a `ContextMenu`. Shown only when an item of it is.
- [`ChromeCommand`](https://kurogane-rs.org/docs/api/requests/chromecommand.md): A command Chromium runs in a window of the application's, from a key shortcut or the context menu, as [`App::on_chrome_command`](/docs/api/app/app#method.on_chrome_command) is asked about it. Chromium's own commands are folded by what the user asked for. Every kind of reload is [`Reload`](/docs/api/requests/chromecommand#variant.Reload); the context menu's Copy and Ctrl+C are both [`Copy`](/docs/api/requests/chromecommand#variant.Copy).
- [`CommandDecision`](https://kurogane-rs.org/docs/api/requests/commanddecision.md): The answer of [`App::on_chrome_command`](/docs/api/app/app#method.on_chrome_command).
- [`DownloadDecision`](https://kurogane-rs.org/docs/api/requests/downloaddecision.md): The answer of [`App::on_download`](/docs/api/app/app#method.on_download).
- [`DragDecision`](https://kurogane-rs.org/docs/api/requests/dragdecision.md): The answer of [`App::on_drag_enter`](/docs/api/app/app#method.on_drag_enter).
- [`FileDialogDecision`](https://kurogane-rs.org/docs/api/requests/filedialogdecision.md): The answer of [`App::on_file_dialog`](/docs/api/app/app#method.on_file_dialog).
- [`FileDialogKind`](https://kurogane-rs.org/docs/api/requests/filedialogkind.md): What kind of file chooser a page opens (`FileDialogRequest::kind`).
- [`Key`](https://kurogane-rs.org/docs/api/requests/key.md): A key by its place on the keyboard rather than what it types. Shift+W and W are both `Key::Char('W')`.
- [`KeyDecision`](https://kurogane-rs.org/docs/api/requests/keydecision.md): The answer of [`App::on_key`](/docs/api/app/app#method.on_key).
- [`MediaKind`](https://kurogane-rs.org/docs/api/requests/mediakind.md): What kind of media was right-clicked.
- [`MenuItem`](https://kurogane-rs.org/docs/api/requests/menuitem.md): An item of a `ContextMenu`.
- [`NavigationDecision`](https://kurogane-rs.org/docs/api/requests/navigationdecision.md): The answer of [`App::on_navigation`](/docs/api/app/app#method.on_navigation).
- [`NewWindowDecision`](https://kurogane-rs.org/docs/api/requests/newwindowdecision.md): The answer of [`App::on_new_window`](/docs/api/app/app#method.on_new_window).
- [`NewWindowKind`](https://kurogane-rs.org/docs/api/requests/newwindowkind.md): How a page asked for a window of its own (`NewWindowRequest::kind`).
- [`Permission`](https://kurogane-rs.org/docs/api/requests/permission.md): What a page asks for, in a `PermissionRequest`.
- [`PermissionDecision`](https://kurogane-rs.org/docs/api/requests/permissiondecision.md): The answer of [`App::on_permission`](/docs/api/app/app#method.on_permission).
- [`StandardItem`](https://kurogane-rs.org/docs/api/requests/standarditem.md): One of Kurogane's items, which runs a command of Chromium's.
