Expand description

Millennium is a framework for building tiny, blazing fast binaries for all major desktop platforms. Developers can integrate any front-end framework that compiles to HTML, JS and CSS for building their user interface. The backend of the application is a rust-sourced binary with an API that the front-end can interact with.

Cargo features

The following are a list of Cargo features that can be enabled or disabled:

  • millennium_webview (enabled by default): Enables the Millennium Webview runtime. Only disable it if you want a custom runtime.
  • dox: Internal feature to generate Rust documentation without linking on Linux.
  • objc-exception: Wrap each msg_send! in a @try/@catch and panics if an exception is caught, preventing Objective-C from unwinding into Rust.
  • isolation: Enables the isolation pattern. Enabled by default if the millennium > pattern > use config option is set to isolation in the .millenniumrc file.
  • custom-protocol: Feature managed by the Millennium CLI. When enabled, Millennium assumes a production environment instead of a development one.
  • updater: Enables the application auto updater. Enabled by default if the updater config is defined in the .millenniumrc file.
  • devtools: Enables the developer tools (Web inspector) and Window::open_devtools. Enabled by default on debug builds. On macOS it uses private APIs, so you can’t enable it if your app will be published to the App Store.
  • shell-open-api: Enables the api::shell module.
  • http-api: Enables the api::http module.
  • http-multipart: Adds support for multipart/form-data HTTP requests.
  • reqwest-client: Uses reqwest as HTTP client on the http APIs. Improves performance, but increases the bundle size.
  • process-command-api: Enables the api::process::Command APIs.
  • global-shortcut: Enables the global shortcut APIs.
  • clipboard: Enables the clipboard APIs.
  • process-relaunch-dangerous-allow-symlink-macos: Allows the api::process::current_binary function to allow symlinks on macOS. This is dangerous, see the Security section in the function’s documentation.
  • dialog: Enables the api::dialog module.
  • notification: Enables the api::notification module.
  • fs-extract-api: Enables the api::file::Extract API.
  • cli: Enables usage of clap for CLI argument parsing. Enabled by default if the cli config is defined on the .millenniumrc file.
  • system-tray: Enables application system tray API. Enabled by default if the systemTray config is defined on the .millenniumrc file.
  • macos-private-api: Enables features only available in macOS’s private APIs, currently the transparent window functionality and the fullScreenEnabled preference setting to true. Enabled by default if the millennium > macosPrivateApi config flag is set to true on the .millenniumrc file.
  • window-data-url: Enables usage of data URLs on the webview.
  • compression: Enables asset compression. You should only disable this if you want faster compile times in release builds, though it produces larger binaries.
  • icon-ico: Adds support to set .ico window icons. Enables Icon::File and Icon::Raw variants.
  • icon-png: Adds support to set .png window icons. Enables Icon::File and Icon::Raw variants.

Cargo allowlist features

The following are a list of Cargo features that enables commands for Millennium’s API package. These features are automatically enabled by the Millennium CLI based on the allowlist configuration under .millenniumrc.

  • api-all: Enables all API endpoints.

Clipboard allowlist

Dialog allowlist

Filesystem allowlist

Global shortcut allowlist

HTTP allowlist

Notification allowlist

OS allowlist

Path allowlist

Process allowlist

Protocol allowlist

  • protocol-all: Enables all Protocol APIs.
  • protocol-asset: Enables the asset custom protocol.

Shell allowlist

Window allowlist

Re-exports

pub use millennium_utils as utils;
pub use self::window::Monitor;
pub use self::window::Window;
pub use self::window::WindowBuilder;
pub use scope::*;

Modules

The Millennium API interface.

The singleton async runtime used by Millennium and exposed to users.

The Millennium custom commands types and traits.

The Millennium plugin extension to expand Millennium functionality.

The allowlist scopes.

updaterupdater

The Millennium updater.

The Millennium window types and functions.

Macros

Reads the config file at compile time and generates a Context based on its content.

Accepts a list of commands functions. Creates a handler that allows commands to be called from JS with invoke().

Include a Context that was generated by [millennium-build] inside your build script.

Structs

Application metadata for the MenuItem::About action.

The instance of the currently running application.

A handle to the currently running application.

A resolved asset.

The asset resolver is a helper to access the millennium_utils::assets::Assets interface.

Builds a Millennium application.

Api exposed on the CloseRequested event.

The .millenniumrc file is generated by the millennium init command. It controls how your app behaves, what windows it launches, and how the app is bundled.

User supplied data required inside of a Millennium application.

A custom menu item.

Information about environment variables.

An event that was triggered.

Represents an event handler.

A window event that was triggered on the specified window.

The message and resolver given to a custom command.

Error response from an InvokeMessage.

An invoke message.

The payload used on the IPC invoke.

Resolver of a invoke message.

A position represented in logical pixels.

A size represented in logical pixels.

A window menu.

The window menu event.

millennium::App package information.

The payload for the OnPageLoad hook.

The path resolver is a helper for the application-specific crate::api::path APIs.

A position represented in physical pixels.

A size represented in physical pixels.

Metadata for a runtime event loop iteration on run_iteration.

A guard for a state value.

The Millennium state manager.

SystemTraysystem-tray

A handle to a system tray. Allows updating the context menu items.

SystemTrayMenusystem-tray

A system tray menu.

The attributes used to create an webview.

A menu event that was triggered on a window.

Enums

Application’s activation policy. Corresponds to NSApplicationActivationPolicy.

Describes the appearance of the mouse cursor.

Runtime errors that can happen inside a Millennium application.

The user event type.

The file drop event payload.

An icon definition.

Response from a InvokeMessage passed to the InvokeResolver.

An entry on the system tray menu.

A menu item, bound to a pre-defined action or Custom emit an event. Note that status bar only supports Custom menu item variants. And on the menu bar, some platforms might not support some of the variants. Unsupported variant will be no-op on such platform.

Named images defined by the system.

An application pattern.

A position that’s either physical or logical.

An application event, triggered from the event loop.

A size that’s either physical or logical.

SystemTrayEventsystem-tray

System tray event.

System tray menu item.

System theme.

Updater events.

Type of user attention requested on a window.

An event from a window.

An URL to open on a Millennium webview window.

Traits

Represents a container of file assets that are retrievable during runtime.

Clipboard manager.

GlobalShortcutManagerglobal-shortcut

A global shortcut manager.

Manages a running application.

The webview runtime interface. A wrapper around runtime::Runtime with the proper user event type associated.

Functions

Requests a single instance lock for the application. This can be used to ensure that only one instance of your app is open at a time.

Type Definitions

A closure that is run everytime Millennium receives a message it doesn’t explicitly handle.

A closure that is responsible for respond a JS message.

MillenniumWebviewmillennium_webview

A Millennium Runtime wrapper around Millennium Webview.

A closure that is run once every time a window is created and loaded.

Result<T, ::millennium::Error>

A closure that is run when the Millennium application is setting up.

A task to run on the main thread.

Attribute Macros

Mark a function as a command handler. It creates a wrapper function with the necessary glue code.