- Docs
- enzUI framework
- Developers
Desktop services
Portals, opening files and links, clipboard, notifications, single instance, tray, persistence, credentials and other capabilities that are not widgets.
Beyond widgets, enzUI provides models, services and platform integrations an app calls directly. Most live in enzui-core and enzui-services, each heavy backend behind a feature (see Project layout and features). The repository's docs/core-capabilities.md is the full keyword index: search it by intent ("hotkey", "remember window size", "store a password") before writing your own.
Portals
enzui_core::portal is a portal-first layer over the XDG Desktop Portal, with typed lifecycle outcomes for each operation. The D-Bus backend (feature portal-dbus, forwarded by enzui-widgets) activates an installed portal asynchronously, and the app's portal code does not depend on GTK, GDK or libadwaita: the host's portal service can be implemented by any toolkit. When no portal service answers, calls return a typed unavailable result rather than failing silently.
Portal modules cover the file chooser, opening URIs and files, notifications, printing, screenshots, screen casting through PipeWire, global shortcuts, background permission and inhibiting idle or logout. Dialogs are parented to the app's window through portal::parent: an xdg-foreign export on Wayland, an x11: window id on X11.
Files and links
- File chooser.
file_chooser::ChooserSessionholds a lazily initialized backend and one tagged request. Start it on a user gesture, include its subscription, and callpumpon a chooser wake; a completed result gives the chosen files withresult.local_paths(). An in-app chooser stands in when no portal answers.cancel(CancelReason)settles a request at once; useParentClosedwhen its window closes. When a chooser cannot run,file_chooser::failure_text(&outcome)is the translated message to show. - Opening links and files.
portal::open_uriopens a URI or file with the desktop's default handler: the launcher for a native process, the portal inside a sandbox.
let uri = OpenUri::parse("https://iced.rs").unwrap();
let started = OpenUriRequest::new(uri, PortalParent::None)
.start(&mut *self.launcher, |_| true); OpenFileRequest::containing_folder(file, parent) shows a file in its folder in the file manager.
- Portal results are URIs. Convert with
FileUri::to_pathand handle failures, rather than strippingfile://yourself.
Clipboard and drag and drop
On Wayland, app_setup::run installs enzui-clipboard on the application's own connection: text, HTML, images (with enzui-clipboard-runtime/image) and file lists. Fields offer the primary selection and paste it on a middle click. When the app exits, what it still owns is handed to a keeper so it survives where the compositor offers ext_data_control_v1. On X11 the runtime's default clipboard is used. ENZUI_CLIPBOARD=default keeps iced's provider on Wayland too.
Native drag and drop with other applications is on Drag and drop.
Desktop settings
enzui_core::desktop_settings reads what the desktop says about button layout, accent colour, contrast, clock format and fonts, from GTK's settings.ini and, with portal-dbus, the Settings portal and its change signal. app_setup::run starts the watcher, and widgets follow it on their own.
Launching, one instance and search
- Launch arguments.
enzui_core::activation::launch_requestreads a launch's arguments into aLaunchRequest: files become absolutefile://URIs, URIs stay, and the intent isOpenorActivate. - Single instance.
single_instance::SingleInstance::start(app_id)(featureapplication-dbus) owns the application or forwards a second launch's files to it. See Packaging. - D-Bus activation.
enzui_core::activation::dbus::ApplicationService::connect(id)servesorg.freedesktop.Application, so launchers and notification actions can start or reach the app. - Search.
ApplicationService::serve_searchanswers the desktop's search over GNOME Shell's and KRunner's interfaces as well as enzUI's. - Activation tokens. Raising a window uses
XDG_ACTIVATION_TOKENon Wayland andDESKTOP_STARTUP_IDon X11.
Notifications, tray and launcher
- Desktop notifications go through the notification portal, or through
org.freedesktop.Notificationsoutside a sandbox (featurenotification-freedesktop), with actions, replacement and withdrawal. They are attributed to the app's id. - Tray icon:
enzui_core::tray::TraywithTrayItem,TrayIconand a menu (featureshell-integration). It needs a StatusNotifierItem host: KDE, the GNOME AppIndicator extension, or waybar. - Launcher badge:
enzui_core::launcher_badge::LauncherBadgesets a count and urgent mark on the app's launcher entry. - Dock progress:
enzui-activitypublishes background activity, and emits the standardcom.canonical.Unity.LauncherEntryprogress signal when its own socket is unreachable.
Persisting state and credentials
enzui_core::persist::Storesaves a typed value through aFileBackend(for exampleFileBackend::xdg(..)under$XDG_CONFIG_HOME) with an explicitRawByteLimit. Loads report loaded, absent, refused and malformed state distinctly, and a failed load never authorizes overwriting the file. Saves are atomic.- Credentials:
enzui_services::credential_store::connect_for_app(featuressecret-service,secret-portal) uses the Secret Service on a desktop. Inside a sandbox it seals a keyring file in the app's data directory with the Secret portal's per-app secret. - OAuth:
enzui_services::oauth(featureoauth) runs the authorization code flow with PKCE through the system browser.
Windows and the compositor
Some Wayland services require support from the compositor.
| Capability | API |
|---|---|
| Monitors | iced::window::Monitor |
| The desktop's alert sound or flash | system_bell (xdg_system_bell_v1) |
| A window icon | through xdg_toplevel_icon_v1 |
| Session restore: the window comes back where it was | window_placement::session::WindowSession (xdg-session-management) |
| Content type and tearing hints | surface_hints (wp_content_type_v1, wp_tearing_control_v1) |
| A notice after a crash | crash_report::CrashReporter and crash_notice::enz_crash_notice |
Several windows in one process use window_lifecycle::WindowLedger to decide when to exit.
Media, documents and more
| Need | Where |
|---|---|
| Audio and video playback, event sounds | enzui-services, feature gstreamer |
| Media keys and desktop media controls | enzui-services, feature mpris |
| PDF thumbnails and video poster frames | enzui_services::document_preview (pdf-preview, gstreamer) |
| Writing a PDF for printing or export | print_pdf::PdfDocument |
| Spell checking | enzui_services::spell_check (feature spell-check) |
| Archive extraction | feature archive |
| Git repository status, read without running Git | enzui_services::vcs |
| The freedesktop thumbnail cache | enzui-core, feature thumbnail-cache |
| Freedesktop icon themes | enzui-services, feature desktop-icons |
| Downloads | enzui_core::download and enz_download_list |
| Mail transport (SMTP, IMAP) | enzui-services, feature mail-transport |
| A terminal | the enzui-terminal crate |
Named, discoverable commands are enzui_core::Action values (label, icon, shortcut, enabled state). Menus, the command palette, toolbars and the shortcut dispatcher all consume them, so model commands as actions rather than bare closures.