Expand description
§FC GPUI
A GPU-accelerated UI framework for Rust, forked from Zed’s GPUI. fc-gpui extends the original framework with daemon-mode capabilities, system tray integration, global hotkeys, native notifications, and more — making it suitable for background apps, menu bar utilities, and overlay tools.
§Getting Started
fc-gpui 0.11.3 is published on crates.io. The unrelated adabraka-gpui registry crate is
the upstream Augani crate at 0.5.1 and does not
carry this fork’s releases. Depend on the crates.io package:
fc-gpui = "0.11.3"Building requires the toolchain pinned in
rust-toolchain.toml:
Rust 1.97.1 with edition 2024.
To keep the build small, disable default features and opt into only the image formats you need:
fc-gpui = { version = "0.11.3", default-features = false, features = [
"font-kit",
"wayland",
"x11",
"image-format-png",
"image-format-jpeg",
"image-format-webp",
] }image-format-* features map to the underlying image crate decoder features. image-rayon
re-enables parallel decoding. SVG support is handled separately through resvg.
Note that keyring (Linux Secret Service credentials storage) and accessibility are also
default features; add "keyring" back to the list above if your app calls
write_credentials / read_credentials / delete_credentials.
§Import Naming
The published package is fc-gpui, but the library target keeps the upstream gpui namespace,
so a plain dependency imports as gpui and Zed-derived code compiles unchanged:
use gpui::*;Renaming the dependency is also supported — the GPUI macros (derives, register_action!,
#[gpui::test]) follow the dependency key:
[dependencies]
gpui = { package = "fc-gpui", version = "0.11.3" }The utility crates (fc-gpui-util, fc-gpui-http-client, …) import under their matching
fc_gpui_* library names.
§Macro Dependency Override
Macro paths are resolved automatically for normal fc-gpui dependencies and ordinary
Cargo aliases. If one package directly lists both fc-gpui and fc-gpui-core, or
uses an alias that is indistinguishable from the normalized package name, select the intended
crate once in the consuming package’s Cargo.toml:
[package.metadata.gpui-macros]
crate = "core_ui"The value must be the Rust dependency identifier visible to that package. It applies consistently
to derive macros, register_action!, and #[gpui::test]. An ambiguous direct dependency graph
without this override fails with an actionable macro error instead of guessing a crate.
§Platform Support
| Feature | macOS | Linux (X11) | Linux (Wayland) | Windows |
|---|---|---|---|---|
| GPU-accelerated rendering | Metal | Vulkan/OpenGL | Vulkan/OpenGL | DirectX |
| System tray icon & menu | Yes | Yes (DBus/SNI) | Yes (DBus/SNI) | Yes (Shell_NotifyIcon) |
| Tray menu actions | Yes | Yes | Yes | Yes |
| Global hotkeys | Yes | Yes (XGrabKey) | No (protocol limitation) | Yes (RegisterHotKey) |
| Native notifications | Yes (UNUserNotification) | Yes (notify-rust) | Yes (notify-rust) | Yes (Shell balloon) |
| Overlay windows (always-on-top) | Yes | Yes | Yes (WindowKind::LayerShell) | Yes |
| Click-through windows | Yes | Yes (Shape ext) | Yes (wl_region) | Yes (WS_EX_TRANSPARENT) |
| Window show/hide | Yes | Yes | Yes | Yes |
| Auto-launch at login | Yes (SMAppService) | Yes (XDG autostart) | Yes (XDG autostart) | Yes (Registry) |
| Single instance lock | Yes (Unix socket) | Yes (Unix socket) | Yes (Unix socket) | Yes (Named mutex) |
| Focused window info | Yes (Accessibility) | Yes (EWMH) | No | Yes (Win32) |
| Permission queries | Yes (Accessibility, Mic) | No | No | No |
| Daemon mode (no dock icon) | Yes (Accessory policy) | Yes | Yes | Yes |
§Rendering Backends
Linux X11 and Wayland use the internal wgpu renderer ported from Zed’s current GPUI backend. Blade is no longer part of the crate. The default macOS renderer is Metal and Windows uses DirectX.
Downstream applications continue to use only fc-gpui; the renderer package is an internal
implementation dependency and does not change the Application::new() entry point. See
the WGPU migration notes for details.
§Accessibility
fc-gpui exposes AccessKit-backed roles, labels, values, focus, and action handlers on elements. Native adapters connect the generated accessibility tree to macOS Accessibility, Linux AT-SPI, and Windows UI Automation.
Native adapters are enabled by the default accessibility feature. Disable default features to
exclude their platform dependencies; the core accessibility API remains available but inactive.
cargo run -p fc-gpui --example a11ySee examples/a11y.rs for focus navigation, accessible actions, numeric
values, switches, and list metadata.
§Wayland Layer Shell
Create a layer-shell surface with WindowKind::LayerShell. The Wayland backend requires
wlr-layer-shell; opening the window fails with LayerShellNotSupportedError when the selected
backend or compositor does not support that protocol. Compositors older than wlr-layer-shell
version 5 cannot select exclusive_edge, so that option is ignored with a warning. A width or
height of zero is passed through to let the compositor choose that dimension.
Applications upgrading from 0.6.x should follow the
layer-shell migration and implementation provenance guide.
use gpui::{
Bounds, WindowBounds, WindowKind, WindowOptions,
layer_shell::{Anchor, KeyboardInteractivity, LayerShellOptions}, point, px, size,
};
let popup_bounds = Bounds::new(point(px(1520.0), px(820.0)), size(px(320.0), px(220.0)));
let options = WindowOptions {
window_bounds: Some(WindowBounds::Windowed(popup_bounds)),
kind: WindowKind::LayerShell(LayerShellOptions {
namespace: "gpui-popup".to_string(),
anchor: Anchor::TOP | Anchor::RIGHT,
margin: Some((px(24.0), px(24.0), px(0.0), px(0.0))),
keyboard_interactivity: KeyboardInteractivity::None,
..Default::default()
}),
..WindowOptions::default()
};The layer-shell regression tests avoid requiring a real compositor. They cover configure sizing and protocol enum mapping:
cargo test -p fc-gpui-core --lib --features test-support layer_shell
cargo check -p fc-gpui --example layer_shell --features wayland§Features
§Core UI Framework (inherited from GPUI)
- Hybrid immediate/retained mode rendering
- GPU-accelerated with Metal, Vulkan, OpenGL, and DirectX backends
- Tailwind-style layout and styling API
- Entity-based state management
- Declarative views with the
Rendertrait - Low-level
ElementAPI for custom rendering - Async executor integrated with the platform event loop
- Action system for keyboard shortcuts
- AccessKit accessibility tree and native platform adapters
- Test framework with
#[gpui::test]
§Daemon & Background App Support (new in fc-gpui)
- System tray — icon, tooltip, and nested menus with action callbacks
- Global hotkeys — register system-wide keyboard shortcuts
- Native notifications — OS-level notifications on all platforms
- Overlay windows — always-on-top transparent windows
- Click-through windows — mouse events pass through to windows below
- Window show/hide — programmatic visibility control
- Auto-launch — register your app to start at login
- Single instance — prevent multiple copies with activation signaling
- Keep alive without windows — apps stay alive with no visible windows via
QuitMode::Explicit, set throughApplication::with_quit_modeorApp::set_quit_mode - Focused window info — query which window the user is focused on
- Permission status — check accessibility and microphone permissions
- In-app toast notifications — stackable, auto-dismissing toast component (deprecated; use the fc-ui toast component instead)
§Quick Example
use gpui::{App, Application, TrayMenuItem};
fn main() {
Application::new().run(|cx: &mut App| {
cx.set_quit_mode(gpui::QuitMode::Explicit);
cx.set_tray_tooltip("My App");
cx.set_tray_menu(vec![
TrayMenuItem::Action {
label: "Settings".into(),
id: "settings".into(),
},
TrayMenuItem::Separator,
TrayMenuItem::Action {
label: "Quit".into(),
id: "quit".into(),
},
]);
cx.on_tray_menu_action(|id, cx| match id.as_ref() {
"quit" => cx.quit(),
_ => {}
});
});
}§Dependencies
§macOS
- Xcode with macOS components
- Xcode command line tools:
xcode-select --install
§Linux
- Standard development packages for your distro
- For X11:
libxcb,libxkbcommon - For Wayland:
libwayland-client,libxkbcommon - GPU backend: wgpu with Vulkan/OpenGL support
- D-Bus (for system tray via StatusNotifierItem)
§Windows
- Visual Studio Build Tools with C++ workload
- Windows SDK
§License
Apache-2.0
Modules§
- accesskit
- colors
- The default colors used by GPUI.
- http_
client - inspector_
reflection - Provides definitions used by
#[derive_inspector_reflection]. - layer_
shell - Wayland layer-shell window configuration.
- prelude
- The GPUI prelude is a collection of traits and types that are widely used throughout the library. It is recommended to import this prelude into your application to avoid having to import each trait individually.
- single_
instance - Cross-platform single instance enforcement using Unix domain sockets and Windows named mutexes.
- styled_
reflection - Implements function reflection
- window_
positioner - Pure Rust utility for computing window bounds from a semantic
WindowPosition.
Macros§
- actions
- Defines and registers unit structs that can be used as actions. For more complex data types, derive
Action. - register_
action - This can be used to register an action with the GPUI runtime when you want to manually implement
the
Actiontrait. Typically you should use theActionderive macro oractions!macro instead.
Structs§
- A11y
Callbacks - Callbacks for the accessibility adapter.
- Activity
Guard - Keeps an operating system activity, such as an idle sleep inhibitor, alive until dropped.
- Anchored
- An anchored element that can be used to display UI that will avoid overflowing the window bounds.
- Anchored
State - The state that the anchored element element uses to track its children.
- Animation
- An animation that can be applied to an element.
- Animation
Element - A GPUI element that applies an animation to another element
- Animation
Handle - A handle that can be used to cancel an in-flight animation.
- Animation
Phase - A potentially overshooting coordinate within an animation.
- AnyDrag
- Contains state associated with an active drag operation, started by dragging an element within the window or by dragging into the app from the underlying platform.
- AnyElement
- A dynamically typed element that can be used to store any element type.
- AnyEntity
- A dynamically typed reference to a entity, which can be downcast into a
Entity<T>. - AnyImage
Cache - A dynamically typed image cache, which can be used to store any image cache
- AnyTooltip
- Contains state associated with a tooltip. You’ll only need this struct if you’re implementing tooltip behavior on a custom element. Otherwise, use Div::tooltip.
- AnyView
- A dynamically-typed handle to a view, which can be downcast to a Entity for a specific type.
- AnyWeak
Entity - A type erased, weak reference to a entity.
- AnyWeak
View - A weak, dynamically-typed view handle that does not prevent the view from being released.
- AnyWindow
Handle - A handle to a window with any root view type, which can be downcast to a window with a specific root view type.
- App
- Contains the state of the full application, and passed as a reference to a variety of callbacks.
Other Context derefs to this type.
You need a reference to an
Appto access the state of a Entity. - AppResource
Profile - Fine-grained resource budget for a GPUI application.
- Application
- Configures and launches a GPUI application.
- Application
Handle - A strong handle to an
Applicationstarted withApplication::run_embedded. - Arena
Clear Needed - Returned when the element arena has been used and so must be cleared before the next draw.
- Async
App - An async-friendly version of App with a static lifetime so it can be held across
awaitpoints in async code. You’re provided with an instance when calling App::spawn, and you can also create one with App::to_async. Internally, this holds a weak reference to anApp, so its methods are fallible to protect against cases where the App is dropped. - Async
Window Context - A cloneable, owned handle to the application context, composed with the window associated with the current task.
- Atlas
Texture Id - Atlas
Tile - Background
- A background color, which can be a solid color, linear gradient, radial gradient, or conic gradient.
- Background
Executor - A pointer to the executor that is currently running, for spawning background tasks.
- Binding
Index - Index of a binding within a keymap.
- Boundary
- A boundary between two lines of text.
- Bounds
- Represents a rectangular area in a 2D space with an origin point and a size.
- Bounds
Refinement - A refinable version of [
#ident], see that documentation for details. - BoxShadow
- The possible values of the box-shadow property
- Canvas
- A canvas element, meant for accessing the low level paint API without defining a whole custom element
- Capslock
- The state of the capslock key at some point in time
- Cascade
- A cascade of refinements that can be merged in priority order.
- Cascade
Slot - A handle to a specific slot in a cascade.
- Clipboard
Item - A clipboard item that should be copied to the clipboard
- Clipboard
String - A clipboard item that should be copied to the clipboard
- Container
Query - A container query element, created with
container_query. - Content
Mask - Indicates which region of the window is visible. Content falling outside of this mask will not be rendered. Currently, only rectangular content masks are supported, but we give the mask its own type to leave room to support more complex shapes in the future.
- Context
- The app context, with specialized behavior for the given entity.
- Context
Entry - An entry in a KeyContext
- Corners
- Represents the corners of a box in a 2D space, such as border radius.
- Corners
Refinement - A refinable version of [
#ident], see that documentation for details. - Crash
Report - Information collected for a crash report.
- Debug
Below - Use this struct for interfacing with the ‘debug_below’ styling from your own elements. If a parent element has this style set on it, then this struct will be set as a global in GPUI.
- Decoration
Run - Set the text decoration for a run of text.
- Deferred
- An element which delays the painting of its child until after all of its ancestors, while keeping its layout as part of the current element tree.
- Deferred
Scroll ToItem - Device
Pixels - Represents physical pixels on the display.
- Dialog
Options - Options for displaying a native dialog.
- Dismiss
Event - Emitted by implementers of
ManagedViewto indicate the view should be dismissed, such as when a view is presented as a modal. - Dispatch
Event Result - Display
Id - An opaque identifier for a hardware display
- Div
- A
Divelement, the all-in-one element for building complex UIs in GPUI - DivFrame
State - A frame state for a
Divelement, which contains layout IDs for its children. - DivInspector
State - Interactivity state displayed an manipulated in the inspector.
- Drag
Move Event - An event for when a drag is moving over this element, with the given state type.
- Drawable
- A wrapper around an implementer of
Elementthat allows it to be drawn in a window. - Dummy
Keyboard Mapper - A dummy implementation of the platform keyboard mapper
- Edges
- Represents the edges of a box in a 2D space, such as padding or margin.
- Edges
Refinement - A refinable version of [
#ident], see that documentation for details. - Element
Clicked State - Whether or not the element or a group that contains it is clicked by the mouse.
- Element
Input Handler - The canonical implementation of
PlatformInputHandler. CallWindow::handle_inputwith an instance during your element’s paint. - Empty
- The empty element, which renders nothing.
- Empty
View - A view that renders nothing
- Entity
- A strong, well-typed reference to a struct which is managed by GPUI
- Entity
Id - A unique identifier for a entity across the application.
- External
Paths - A collection of paths from the platform, such as from a file drop.
- Fallback
Prompt Renderer - The default GPUI fallback for rendering prompts, when the platform doesn’t support it.
- Fill
Options - Parameters for the fill tessellator.
- Focus
Handle - A handle which can be used to track and manipulate the focused element in a window.
- FocusId
- A globally unique identifier for a focusable element.
- Focus
OutEvent - This is provided when subscribing for
Context::on_focus_outevents. - Focused
Window Info - Information about the currently focused window from any application.
- Font
- The configuration details for identifying a specific font.
- Font
Fallbacks - The fallback fonts that can be configured for a given font. Fallback fonts family names are stored here.
- Font
Family Id - An opaque identifier for a specific font family.
- Font
Features - The OpenType features that can be configured for a given font.
- FontId
- An opaque identifier for a specific font.
- Font
Metrics - A struct for storing font metrics. It is used to define the measurements of a typeface.
- FontRun
- A run of text with a single font.
- Font
Weight - The degree of blackness or stroke thickness of a font. This value ranges from 100.0 to 900.0, with 400.0 as normal.
- Foreground
Executor - A pointer to the executor that is currently running, for spawning tasks on the main thread.
- Global
Element Id - A globally unique identifier for an element, used to track state across frames.
- GlyphId
- An identifier for a specific glyph, as returned by
WindowTextSystem::layout_line. - GpuResource
Budget - GPU resource budget.
- GpuSpecs
- Information about the GPU GPUI is running on.
- Gpui
Borrow - A mutable reference to an entity owned by GPUI
- Grid
Location - A location in a grid layout.
- Grid
Template - A simplified representation of a repeated
grid-template-*value. - Grid
Template Refinement - A refinable version of [
#ident], see that documentation for details. - Group
Style - The styling information for a given group.
- Highlight
Style - A highlight style to apply, similar to a
TextStyleexcept for a single font, uniformly sized and spaced text. - Hitbox
- A rectangular region that potentially blocks hitboxes inserted prior. See Window::insert_hitbox for more details.
- Hitbox
Id - An identifier for a Hitbox which also includes HitboxBehavior.
- Hsla
- An HSLA color
- Image
- An image, with a format and certain bytes
- Image
Cache Element - An image cache element.
- Image
Cache Item - Owns an image load and its cached result.
- Image
Format Iter - An iterator over the variants of ImageFormat
- ImageId
- A unique identifier for the image cache
- Image
Style - The style of an image element.
- Img
- An image element.
- ImgLayout
State - The image layout state between frames
- Inspector
- Manages inspector state - which element is currently selected and whether the inspector is in picking mode.
- Inspector
Element Id - A unique identifier for an element that can be inspected.
- Inspector
Element Path GlobalElementIdqualified by source location of element construction.- Interactive
Element State - The per-frame state of an interactive element. Used for tracking stateful interactions like clicks and scroll offsets.
- Interactive
Text - A text element that can be interacted with.
- Interactivity
- The interactivity struct. Powers all of the general-purpose
interactivity in the
Divelement. - Invalid
Keystroke Error - Error type for
Keystroke::parse. This is used instead ofanyhow::Errorso that Zed can use markdown to display it. - Item
Size - The size of the item and its contents.
- KeyBinding
- A keybinding and its associated metadata, from the keymap.
- KeyBinding
Meta Index - A unique identifier for retrieval of metadata associated with a key binding. Intended to be used as an index or key into a user-defined store of metadata associated with the binding, such as the source of the binding.
- KeyContext
- A datastructure for resolving whether an action should be dispatched at this point in the element tree. Contains a set of identifiers and/or key value pairs representing the current context for the keymap.
- KeyDown
Event - The key down event equivalent for the platform.
- KeyUp
Event - The key up event equivalent for the platform.
- Keybinding
Keystroke - Represents a keystroke that can be used in keybindings and displayed to the user.
- Keyboard
Click Event - A click event that was generated by a keyboard button being pressed and released.
- Keymap
- A collection of key bindings for the user’s application.
- Keymap
Version - An opaque identifier of which version of the keymap is currently active. The keymap’s version is changed whenever bindings are added or removed.
- Keystroke
- A keystroke and associated metadata generated by the platform
- Keystroke
Event - A keystroke event, and potentially the associated action
- Layout
Id - A unique identifier for a layout node, generated when requesting a layout from Taffy
- Line
Layout - A laid out and styled line of text
- Line
Wrapper - The GPUI line wrapper, used to wrap lines of text to a given width.
- Line
Wrapper Handle - A handle into the text system, which can be used to compute the wrapped layout of text
- Linear
Color Stop - A color stop in a linear gradient.
- List
- A list element
- List
Offset - An offset into the list’s items, in terms of the item index and the number of pixels off the top left of the item.
- List
Prepaint State - Frame state used by the List element after layout.
- List
Scroll Event - A scroll event that has been converted to be in terms of the list’s items.
- List
State - The list state that views must hold on behalf of the list element.
- Menu
- A menu of the application, either a main menu or a submenu
- Missing
Glyph - A grapheme cluster that could not be represented by any available font.
- Modifiers
- The state of the modifier keys at some point in time
- Modifiers
Changed Event - The modifiers changed event equivalent for the platform.
- Monochrome
Sprite - Mouse
Click Event - A click event, generated when a mouse button is pressed and released.
- Mouse
Down Event - A mouse down event from the platform
- Mouse
Exit Event - A mouse exit event from the platform, generated when the mouse leaves the window.
- Mouse
Move Event - A mouse move event from the platform
- Mouse
UpEvent - A mouse up event from the platform
- NoAction
- Action with special handling which unbinds the keybinding this is associated with, if it is the highest precedence match.
- Noop
Text System - Ongoing
Scroll - Tracks the dominant axis across the events in a scroll gesture.
- OsInfo
- Information about the operating system.
- OsMenu
- OS menus are menus that are recognized by the operating system This allows the operating system to provide specialized items for these menus
- Owned
Menu - A menu of the application, either a main menu or a submenu
- Owned
OsMenu - OS menus are menus that are recognized by the operating system This allows the operating system to provide specialized items for these menus
- Padded
Bool32 - A boolean stored as a
u32so GPU-facing structs contain no compiler-inserted padding bytes when reinterpreted as instance data. - Paint
Quad - A rectangle to be rendered in the window at the given position and size.
Passed as an argument
Window::paint_quad. - Paint
Surface - Path
- A line made up of a series of vertices and control points.
- Path
Builder - A
Pathbuilder. - Path
Prompt Options - The options that can be configured for a file dialog prompt
- Path
Vertex - Pending
Input Status - Pending input for a potential multi-stroke key binding.
- Pending
Input Timeout Status - The timeout state for pending input.
- Percentage
- A type representing a percentage value.
- Pinch
Event - A pinch gesture event from the platform, generated when the user performs a pinch-to-zoom gesture.
- Pixels
- Represents a length in pixels, the base unit of measurement in the UI framework.
- Platform
Input Handler - Point
- Describes a location in a 2D cartesian space.
- Point
Refinement - A refinable version of [
#ident], see that documentation for details. - Polychrome
Sprite - Prompt
Handle - A handle to a prompt that can be used to interact with it.
- Prompt
Response - The event emitted when a prompt’s option is selected. The usize is the index of the selected option, from the actions passed to the prompt.
- Quad
- Radians
- Represents an angle in Radians
- Rems
- Represents a length in rems, a unit based on the font-size of the window, which can be assigned with
Window::set_rem_size. - Render
Glyph Params - Render
Image - A cached and processed image, in BGRA format
- Render
Image Params - Renderable
Prompt Handle - A prompt handle capable of being rendered in a window.
- Renderer
Cache Stats - Snapshot of the renderer’s pooled GPU resource usage.
- Request
Frame Options - Reservation
- Returned by Context::reserve_entity to later be passed to Context::insert_entity. Allows you to obtain the EntityId for a entity before it is created.
- Resize
Event - An event that fires when an element’s bounds change size.
- Retain
AllImage Cache - An implementation of ImageCache, that uses an LRU caching strategy to unload images when the cache is full
- Retain
AllImage Cache Provider - A provider struct for creating a retain-all image cache inline
- Rgba
- An RGBA color
- Scaled
Pixels - Represents scaled pixels that take into account the device’s scale factor.
- Scene
- Scope
- Scope manages a set of tasks that are enqueued and waited on together. See
BackgroundExecutor::scoped. - Screen
Capture Frame - A frame of video captured from a screen.
- Scroll
Anchor - Represents an element that can be scrolled to in its parent element.
Contrary to
ScrollHandle::scroll_to_active_item, an anchored element does not have to be an immediate child of the parent. - Scroll
Handle - A handle to the scrollable aspects of an element. Used for accessing scroll state, like the current scroll offset, and for mutating the scroll state, like scrolling to a specific child.
- Scroll
Wheel Event - A mouse wheel event from the platform
- Semantic
Version - A semantic version number.
- Shadow
- Shaped
Glyph - A single glyph, ready to paint.
- Shaped
Line - A line of text that has been shaped and decorated.
- Shaped
Line Cursor - Incrementally splits a
ShapedLineat increasing UTF-8 byte boundaries. - Shaped
Run - A run of text that has been shaped .
- Shared
String - A shared string is an immutable string that can be cheaply cloned in GPUI tasks. Uses SmolStr for efficient storage with inline optimization for small strings.
- Shared
Uri - A
SharedStringcontaining a URI. - Size
- A structure representing a two-dimensional size with width and height in a given unit.
- Size
Refinement - A refinable version of [
#ident], see that documentation for details. - Source
Metadata - Metadata for a given ScreenCaptureSource
- Spring
Animation - A stateful spring animation targeting a value or projected path.
- Spring
Animation Element - A GPUI element driven by a stateful spring.
- Spring
Config - The physical parameters of a damped harmonic oscillator.
- Spring
State - The instantaneous position and velocity of a spring.
- Stateful
- A wrapper around an element that can store state, produced after assigning an ElementId.
- Strikethrough
Style - The properties that can be applied to a strikethrough.
- Strikethrough
Style Refinement - A refinable version of [
#ident], see that documentation for details. - Stroke
Options - Parameters for the tessellator.
- Style
- The CSS styling that can be applied to an element via the
Styledtrait - Style
Refinement - A refinable version of [
#ident], see that documentation for details. - Styled
Text - Renders text with runs of different styles.
- Subscription
- A handle to a subscription created by GPUI. When dropped, the subscription is cancelled and the callback will no longer be invoked.
- Surface
- A surface element.
- Svg
- An SVG element.
- System
Window TabController - A controller for managing window tabs.
- Task
- Task is a primitive that allows work to happen in the background.
- Task
Label - A task label is an opaque identifier that you can use to refer to a task in tests.
- Text
Layout - The Layout for TextElement. This can be used to map indices to pixels and vice versa.
- Text
Resource Budget - Text system resource budget.
- TextRun
- A styled run of text, for use in
crate::TextLayout. - Text
Shadow - A shadow effect applied to text, rendered by painting glyphs twice.
- Text
Style - The properties that can be used to style text in GPUI
- Text
Style Refinement - A refinable version of [
#ident], see that documentation for details. - Text
System - The GPUI text rendering sub system.
- Text
System Cache Stats - Snapshot of the long-lived text-system cache sizes returned by
TextSystem::layout_cache_stats. - TileId
- Tiling
- A type to describe which sides of the window are currently tiled in some way
- Timeout
- Error returned by with_timeout when the timeout duration elapsed before the future resolved
- Timer
- A future or stream that emits timed events.
- Titlebar
Options - The options that can be configured for a window’s titlebar
- Toast
Deprecated - Configuration for a single toast notification.
- Toast
Stack Deprecated - A stack of toast notifications that manages display and auto-dismissal.
- Tooltip
Id - An identifier for a tooltip.
- Transformation
- A transformation to apply to an SVG element.
- Transformation
Matrix - A data type representing a 2 dimensional transformation that can be applied to an element.
- Tray
Anchor - Tray
Icon Click Event - A tray icon click event with optional screen position information.
- UTF16
Selection - A struct representing a selection in a text buffer, in UTF16 characters. This is different from a range because the head may be before the tail.
- Underline
- Underline
Style - The properties that can be applied to an underline.
- Underline
Style Refinement - A refinable version of [
#ident], see that documentation for details. - Uniform
List - A list element for efficiently laying out and displaying a list of uniform-height elements.
- Uniform
List Frame State - Frame state used by the UniformList.
- Uniform
List Scroll Handle - A handle for controlling the scroll position of a uniform list. This should be stored in your view and passed to the uniform_list on each frame.
- Uniform
List Scroll State - Weak
Entity - A weak reference to a entity of the given type.
- Weak
Focus Handle - A weak reference to a focus handle.
- Window
- Holds the state for a specific window.
- Window
Controls - What window controls this platform supports
- Window
Handle - A handle to a window with a specific root view type. Note that this does not keep the window alive on its own.
- Window
Id - A unique identifier for a window.
- Window
Options - The variables that can be configured when creating a new window
- Window
Params - The variables that can be configured when creating a new window
- Window
State - A snapshot of a window’s state for save/restore.
- Window
Text System - The GPUI text layout subsystem.
- Wrap
Boundary - A boundary at which a line was wrapped
- Wrapped
Line - A line of text that has been shaped, decorated, and wrapped by the text layout system.
- Wrapped
Line Layout - A line of text that has been wrapped to fit a given width
Enums§
- Absolute
Length - Represents an absolute length in pixels or rems.
- Accessible
Action - An action to be taken on an accessibility node.
- Action
Build Error - Error type for
Keystroke::parse. This is used instead ofanyhow::Errorso that Zed can use markdown to display it. - Align
Content - Sets the distribution of space between and around content items For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
- Align
Items - Used to control how child nodes are aligned. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis
- Anchored
FitMode - Which algorithm to use when fitting the anchored element to be inside the window.
- Anchored
Position Mode - Which algorithm to use when positioning the anchored element.
- Animation
Repeat - How an
Animationbehaves once one pass finishes. - AppProfile
- Predefined application profiles for common use cases.
- ArcCow
- Asset
Logger - An asset Loader which logs the
Errvariant of aResultduring loading - Atlas
Key - Atlas
Texture Kind - Attention
Type - The type of user attention to request from the OS.
- Available
Space - The space available for an element to be laid out in
- Axis
- Axis in a 2D cartesian space.
- Biometric
Kind - The kind of biometric authentication available.
- Biometric
Status - The availability status of biometric authentication.
- Blend
Mode - The blend mode to apply when rendering a quad.
- Border
Style - The style of a border.
- Click
Event - A click event, generated when a mouse button or keyboard button is pressed and released.
- Clipboard
Entry - Either a ClipboardString or a ClipboardImage
- Color
Space - A color space for color interpolation.
- Corner
- Identifies a corner of a 2d box.
- Cursor
Style - The style of the cursor (pointer)
- Decorations
- A type to describe how this window is currently configured
- Definite
Length - A non-auto length that can be defined in pixels, rems, or percent of parent.
- Dialog
Kind - The kind of a native dialog.
- Dispatch
Phase - Represents the two different phases when dispatching events.
- Display
- Sets the layout used for the children of this node
- Element
Id - An identifier for an
Element. - Fallback
Font Class - The spacing behavior required of a fallback font.
- File
Drop Event - A file drop event from the platform, generated when files are dragged and dropped onto the window.
- Fill
- The kinds of fill that can be applied to a shape.
- Fill
Rule - The fill rule defines how to determine what is inside and what is outside of the shape.
- Flex
Direction - The direction of the flexbox layout main axis.
- Flex
Wrap - Controls whether flex items are forced onto one line or can wrap onto multiple lines.
- Follow
Mode - Controls whether the list automatically follows new content at the end.
- Font
Style - Allows italic or oblique faces to be selected.
- Grid
Placement - The placement of an item within a grid layout’s column or row.
- Hitbox
Behavior - How the hitbox affects mouse behavior.
- Hover
Listener Mode - Controls how
StatefulInteractiveElement::on_hoverresponds to key presses while the mouse is stationary. - Image
Asset Loader - An image loader for the GPUI asset system
- Image
Cache Error - An error that can occur when interacting with the image cache.
- Image
Format - One of the editor’s supported image formats (e.g. PNG, JPEG) - used when dealing with images in the clipboard
- Image
Source - A source of image content.
- Indent
Adjustment - Controls how soft-wrapped continuation lines are indented.
- Input
Preference - Whether a keystroke should prefer character input or key bindings.
- KeyBinding
Context Predicate - A datastructure for resolving whether an action should be dispatched Representing a small language for describing which contexts correspond to which actions.
- Keyboard
Button - An enum representing the keyboard button that was pressed for a click event.
- Length
- A length that can be defined in pixels, rems, percent of parent, or auto.
- Line
Fragment - A fragment of a line that can be wrapped.
- List
Alignment - Whether the list is scrolling from top to bottom or bottom to top.
- List
Horizontal Sizing Behavior - The horizontal sizing behavior to apply during layout.
- List
Measuring Behavior - The measuring behavior to apply during layout.
- List
Sizing Behavior - The sizing behavior to apply during layout.
- Media
KeyEvent - Media key events from hardware media keys or OS media controls.
- Menu
Item - The different kinds of items that can be in a menu
- Mouse
Button - An enum representing the mouse button that was pressed.
- Navigation
Direction - A navigation direction, such as back or forward.
- Network
Status - The current network connectivity status.
- Object
Fit - How to fit the image into the bounds of the element.
- Orientation
- OsAction
- OS actions are actions that are recognized by the operating system This allows the operating system to provide specialized behavior for these actions
- Overflow
- How children overflowing their container should affect layout
- Owned
Menu Item - The different kinds of items that can be in a menu
- Path
Style - Style of the PathBuilder
- Permission
Request Status - Whether the platform accepted a permission request.
- Permission
Status - The status of a system permission.
- Platform
Input - An enum corresponding to all kinds of platform input events.
- Position
- The positioning strategy for this item.
- Power
Save Blocker Kind - The kind of power save blocker to create.
- Primitive
Batch - Progress
BarState - The state of a taskbar/dock progress bar for a window.
- Prompt
Button - Prompt Button
- Prompt
Level - What kind of prompt styling to show
- Quit
Mode - Defines when the application should automatically quit.
- Resize
Anchor - The window corner or edge that stays fixed on screen when the window is
resized via
PlatformWindow::resize_anchored/crate::Window::resize_anchored. - Resize
Edge - Which part of the window to resize
- Resource
- An enum representing
- Role
- The type of an accessibility node.
- Screen
Capture Stream Termination - The terminal state of a started screen-capture stream.
- Scroll
Delta - The scroll delta for a scroll wheel event.
- Scroll
Strategy - Where to place the element scrolled to.
- Spring
Playback - Controls how a spring advances and resolves its presentation value.
- Surface
Source - A source of a surface’s content.
- System
Menu Type - The type of system menu
- System
Power Event - System power state change events.
- Task
Priority - The scheduling priority for a task.
- Template
Column MinSize - The minimum size of a repeated grid column or row.
- Text
Align - How to align text within the element
- Text
Overflow - How to truncate text that overflows the width of the element
- Thermal
State - Thermal state of the system.
- Toast
Position Deprecated - Position where toasts appear on screen.
- Toggled
- Touch
Phase - The phase of a touch motion event. Based on the winit enum of the same name.
- Tray
Icon Event - Events that can occur on a system tray icon.
- Tray
Icon Rendering Mode - Controls how a system tray icon should be rendered.
- Tray
Menu Item - A menu item for a system tray context menu.
- Visibility
- The value of the visibility property, similar to the CSS property
visibility - White
Space - How to handle whitespace in text
- Window
Appearance - The appearance of the window, as defined by the operating system.
- Window
Background Appearance - The appearance of the background of the window itself, when there is no content or the content is transparent.
- Window
Bounds - Represents the status of how a window should be opened.
- Window
Control Area - A type of window control area that corresponds to the platform window.
- Window
Decorations - A type to describe the appearance of a window
- Window
Kind - The kind of window to create
- Window
Position - A semantic window position for positioning windows relative to the screen.
- Window
Visibility - Whether the platform is presenting a window’s frames.
Constants§
- KEYSTROKE_
PARSE_ EXPECTED_ MESSAGE - Sentence explaining what keystroke parser expects, starting with “Expected …”
- LOADING_
DELAY - The delay before showing the loading state.
- SHUTDOWN_
TIMEOUT - The duration for which futures returned from Context::on_app_quit can run before the application fully quits.
- SUBPIXEL_
VARIANTS_ X - Number of subpixel glyph variants along the X axis.
- SUBPIXEL_
VARIANTS_ Y - Number of subpixel glyph variants along the Y axis.
Traits§
- Action
- Actions are used to implement keyboard-driven UI. When you declare an action, you can bind keys to the action in the keymap and listeners for that action in the element tree.
- Along
- A trait for accessing the given unit along a certain axis.
- Animation
Ext - An extension trait for adding the animation wrapper to both Elements and Components
- AppContext
- The context trait, allows the different contexts in GPUI to be used interchangeably for certain operations.
- AsKeystroke
- This is a helper trait so that we can simplify the implementation of some functions
- Asset
- A trait for asynchronous asset loading.
- Asset
Source - A source of assets for this app to use.
- Borrow
AppContext - A helper trait for auto-implementing certain methods on contexts that can be used interchangeably.
- Element
- Implemented by types that participate in laying out and painting the contents of a window. Elements form a tree and are laid out according to web-based layout rules, as implemented by Taffy. You can create custom elements by implementing this trait, see the module-level documentation for more details.
- Entity
Input Handler - Implement this trait to allow views to handle textual input when implementing an editor, field, etc.
- Event
Emitter - A trait for tying together the types of a GPUI entity and the events it can emit.
- Flatten
- A flatten equivalent for anyhow
Results. - Focusable
- Focusable allows users of your view to easily focus it (using window.focus_view(cx, view))
- Future
Ext - Extensions for Future types that provide additional combinators and utilities.
- Gesture
Event - A gesture event from the platform.
- Global
- A marker trait for types that can be stored in GPUI’s global state.
- Half
- Provides a trait for types that can calculate half of their value.
- Image
Cache - An object that can handle the caching and unloading of images. Implementations of this trait should ensure that images are removed from all windows when they are no longer needed.
- Image
Cache Provider - An object that can create an ImageCache during the render phase. See the ImageCache trait for more information.
- Input
Event - An event from a platform input source.
- Input
Handler - Zed’s interface for handling text input from the platform’s IME system This is currently a 1:1 exposure of the NSTextInputClient API:
- Interactive
Element - A trait for elements that want to use the standard GPUI event handlers that don’t require any state.
- Interpolate
- A value that supports linear interpolation and extrapolation.
- Into
Element - Implemented by any type that can be converted into an element.
- IsEmpty
- IsZero
- A trait for checking if a value is zero.
- KeyEvent
- A key event from the platform.
- Managed
View - ManagedView is a view (like a Modal, Popover, Menu, etc.) where the lifecycle of the view is handled by another view.
- Missing
Glyph Sink - Accepts missing glyphs detected by a platform text system.
- Mouse
Event - A mouse event from the platform.
- Negate
- Provides a trait for types that can negate their values.
- Parent
Element - This is a helper trait to provide a uniform interface for constructing elements that can accept any number of any kind of child elements
- Platform
- Low-level operating-system integration contract implemented by GPUI backends.
- Platform
Atlas - Platform
Display - A handle to a platform’s display, e.g. a monitor or laptop screen.
- Platform
Keyboard Layout - A trait for platform-specific keyboard layouts
- Platform
Keyboard Mapper - A trait for platform-specific keyboard mappings
- Platform
Text System - Platform
Window - Prompt
- A prompt that can be rendered in the window.
- Read
Global - A trait for reading a global value from the context.
- Refineable
- A trait for types that can be refined with partial updates.
- Render
- An object that can be drawn to the screen. This is the trait that distinguishes “views” from
other entities. Views are
Entity’s whichimpl Renderand drawn to the screen. - Render
Once - You can derive
IntoElementon any type that implements this trait. It is used to construct reusablecomponentsout of plain data. Think of components as a recipe for a certain pattern of elements. RenderOnce allows you to invoke this pattern, without breaking the fluent builder pattern of the element APIs. - Screen
Capture Source - A source of on-screen video content that can be captured.
- Screen
Capture Stream - A video stream captured from a screen.
- Spring
Target - A value that can be targeted by a one-dimensional spring.
- Stateful
Interactive Element - A trait for elements that want to use the standard GPUI interactivity features that require state.
- Styled
- A trait for elements that can be styled. Use this to opt-in to a utility CSS-like styling API.
- Styled
Image - Style an image element.
- Uniform
List Decoration - A decoration for a
UniformList. This can be used for various things, such as rendering indent guides, or other visual effects. - Update
Global - A trait for updating a global value in the context.
- Visual
Context - This trait is used for the different visual contexts in GPUI that require a window to be present.
Functions§
- anchored
- anchored gives you an element that will avoid overflowing the window bounds. Its children should have no margin to avoid measurement issues.
- auto
- Returns a
Lengthrepresenting an automatic length. - background_
executor - Returns a background executor for the current platform.
- black
- Pure black in
Hsla - blue
- The color blue in
Hsla - bounce
- Apply the given easing function, first in the forward direction and then in the reverse direction
- bounds
- Create a bounds with the given origin and size
- canvas
- Construct a canvas element with the given paint callback. Useful for adding short term custom drawing to a view.
- combine_
highlights - Combine and merge the highlights and ranges in the two iterators.
- conic_
gradient - Creates a conic (sweep) gradient background.
- container_
query - Construct a container query element with the given render callback. The callback receives the size the element was assigned during layout and returns the contents to display within it.
- current_
platform - Returns the current desktop platform implementation.
- deferred
- Builds a
Deferredelement, which delays the layout and paint of its child. - div
- Construct a new
Divelement - ease_
in_ out - The quadratic ease-in-out function, which starts and ends slowly but speeds up in the middle
- ease_
out_ quint - The Quint ease-out function, which starts quickly and decelerates to a stop
- fallback_
prompt_ renderer - Use this function in conjunction with App::set_prompt_builder to force GPUI to always use the fallback prompt renderer.
- fill
- Creates a filled quad with the given bounds and background color.
- font
- Get a
Fontfor a given name. - generate_
list_ of_ all_ registered_ actions - Generate a list of all the registered actions. Useful for transforming the list of available actions into a format suited for static analysis such as in validating keymaps, or generating documentation.
- green
- The color green in
Hsla - guess_
compositor - Returns which Linux compositor the environment indicates without connecting to it.
- hash
- Use a quick, non-cryptographically secure hash function to get an identifier from data
- hsla
- Construct an
Hslaobject from plain values - image_
cache - An image cache element, all its child img elements will use the cache specified by this element.
Note that this could as simple as passing an
Entity<T: ImageCache> - img
- Create a new image element.
- is_
no_ action - Returns whether or not this action represents a removed key binding.
- linear
- The linear easing function, or delta itself
- linear_
color_ stop - Creates a new linear color stop.
- linear_
gradient - Creates a LinearGradient background color.
- list
- Construct a new list element
- multi_
stop_ linear_ gradient - Creates a linear gradient with up to 4 color stops.
- opaque_
grey - Opaque grey in
Hsla, values will be clamped to the range [0, 1] - outline
- Creates a rectangle outline with the given bounds, border color, and a 1px border width
- pattern_
slash - Creates a hash pattern background
- percentage
- Generate a
Radianfrom a percentage of a full circle. - phi
- Returns the Golden Ratio, i.e.
~(1.0 + sqrt(5.0)) / 2.0. - point
- Constructs a new
Point<T>with the given x and y coordinates. - pulsating_
between - A custom easing function for pulsating alpha that slows down as it approaches 0.1
- px
- Constructs a
Pixelsvalue representing a length in pixels. - quad
- Creates a quad with the given parameters.
- quadratic
- The quadratic easing function, delta * delta
- radial_
gradient - Creates a radial gradient background.
- radians
- Create a
Radianfrom a raw value - red
- The color red in
Hsla - relative
- Constructs a
DefiniteLengthrepresenting a relative fraction of a parent size. - rems
- Constructs a
Remsvalue representing a length in rems. - retain_
all - Constructs a retain-all image cache that uses the element state associated with the given ID.
- rgb
- Convert an RGB hex color code number to a color type
- rgba
- Convert an RGBA hex color code number to
Rgba - sampled_
easing - Adapts a spring starting at zero with no velocity to GPUI’s duration-based easing API.
- size
- Constructs a new
Size<T>with the provided width and height. - solid_
background - Creates a solid background color.
- surface
- Create a new surface element.
- svg
- Create a new SVG element.
- transparent_
black - Transparent black in
Hsla - transparent_
white - Transparent white in
Hsla - uniform_
list - uniform_list provides lazy rendering for a set of items that are of uniform height. When rendered into a container with overflow-y: hidden and a fixed (or max) height, uniform_list will only render the visible subset of items.
- white
- Pure white in
Hsla - yellow
- The color yellow in
Hsla
Type Aliases§
- Align
Self - Used to control how the specified nodes is aligned.
Overrides the parent Node’s
AlignItemsproperty. For Flexbox it controls alignment in the cross axis For Grid it controls alignment in the block axis - Draw
Order - ImgResource
Loader - A type alias to the resource loader that the
img()element uses. - Inspector
Renderer - Function set on
Appto render the inspector UI. - Justify
Content - Sets the distribution of space between and around content items For Flexbox it controls alignment in the main axis For Grid it controls alignment in the inline axis
- Justify
Items - Used to control how child nodes are aligned. Does not apply to Flexbox, and will be ignored if specified on a flex container For Grid it controls alignment in the inline axis
- Justify
Self - Used to control how the specified nodes is aligned.
Overrides the parent Node’s
JustifyItemsproperty. Does not apply to Flexbox, and will be ignored if specified on a flex child For Grid it controls alignment in the inline axis - Path
Vertex_ Scaled Pixels - Result
Result<T, Error>- Screen
Capture Termination Callback - Receives a single terminal state from a started screen-capture stream.
- Transform
- Alias for
euclid::default::Transform2D<f32>
Attribute Macros§
- test
#[gpui::test]can be used to annotate test functions that run with GPUI support.
Derive Macros§
- Action
Actionderive macro - see the trait documentation for details.- AppContext
- #[derive(AppContext)] is used to create a context out of anything that holds a
&mut AppNote that a#[app]attribute is required to identify the variable holding the &mut App. - Into
Element - #[derive(IntoElement)] is used to create a Component out of anything that implements
the
RenderOncetrait. - Refineable
- Visual
Context - #[derive(VisualContext)] is used to create a visual context out of anything that holds a
&mut Windowand implementsAppContextNote that a#[app]and a#[window]attribute are required to identify the variables holding the &mut App, and &mut Window respectively.