RFC 0054 — The gui feature: Elyra without a window
Status: implemented (2026-11-24) · Target: 0.55.0 · builds on container & providers, commands, MCP, RFC 0053 · see Decisions
Summary
tao and wry (and, on Linux, GTK and WebKitGTK) are hard dependencies of
the elyra crate. A command-line tool that shares an app's code (its
commands, its database layer, its updater) can't be built without them, so
it can't be built on a server, in a minimal container, or anywhere GTK
isn't installed. ElyraSQL's elyrasql-cli is that tool. Its fork of the
framework has a gui feature for exactly this.
This RFC puts the window behind a gui feature, on by default:
# The app, as today: `gui` is a default feature.
elyra = { …, features = ["database", "updater"] }
# Its command-line twin: no tao, no wry, no GTK.
elyra = { …, default-features = false, features = ["database", "updater"] }
// The CLI: the same commands and services, no event loop.
let app = App::new().provider(Db::provider()).command(export_csv);
let prepared = app.prepare(); // container, registry, bus
let ctx = prepared.ctx;
let rows = export_csv(ctx.clone(), query).await?; // or call it by name
- Without
gui, what an app is made of stays:App's configuration, the container andCtx, commands and their registry, the event bus, codegen, migrations and seeders,--mcpover stdio, the test harness, and the features that need no window (database, http, backend, secrets, ai, updater, sidecar, autostart, microphone). - What needs a window goes with it: the event loop, windows, the tray, the menu, the popover, Quick Look, the matrix and Point at it, global shortcuts, and the file dialogs.
- Nothing changes for an app:
guiis a default feature, andtray,shortcutsandsystemimply it.
Motivation
- ElyraSQL ships
elyrasql-client(the window) andelyrasql-cli(scripts, CI, servers) from one crate. The CLI must build where GTK doesn't exist. Moving off its fork needs this upstream. - Any app with a CLI twin, a server-side worker or a headless test job
sharing its commands gets the same:
cargo buildwithout system webview packages. - It's mostly there already.
--mcp,ELYRA_CODEGEN_OUT,ELYRA_MIGRATE,ELYRA_SEEDandELYRA_CHECKall run without opening a window.TestShelldrives the IPC router without a webview. Only the crate's dependencies say otherwise.
Current state (0.53)
framework/Cargo.toml:taoandwryare unconditional. On Linux, so aremuda(withgtk),webkit2gtk,gioandcairo-rs; on macOS theobjc2-*crates for the popover and snapshots; on Windowswebview2-com.default = [].- Thirteen source files name
taoorwry. Most are inshell/, pluswindow.rs,dev.rs,diagnostics.rsandapp.rs. - The IPC layer (
shell/router.rs,guard.rs,protocol.rs) uses onlywry::http, which is thehttpcrate re-exported.shell/mod.rskeys windows bytao::window::WindowId. Preparedcarrieswindows,tray,menu,iconandshortcuts.systempulls inrfd(file dialogs, GTK on Linux) along withopen,arboard,notify-rustanddirs.
Design
Features
[features]
default = ["gui"]
# The window: tao, wry and the system webview (WebKitGTK on Linux), the
# app menu, and the platform crates the shell uses.
gui = ["dep:tao", "dep:wry", "dep:muda", "dep:webkit2gtk", "dep:gio", "dep:cairo-rs",
"dep:objc2", "dep:objc2-app-kit", "dep:objc2-foundation", "dep:objc2-web-kit",
"dep:block2", "dep:webview2-com"]
tray = ["gui", "dep:tray-icon"]
shortcuts = ["gui", "dep:global-hotkey"]
system = ["gui", "dep:rfd", "dep:open", "dep:arboard", "dep:notify-rust", "dep:dirs"]
The platform crates become optional under their [target.…] tables. The
http crate becomes a direct dependency (it already is one, through wry),
so the IPC layer names it, not wry::http.
What moves behind gui
shell/webview.rs,shell/picture.rs,shell/dev.rs,shell/diagnose.rs(the event loop, the windows, the snapshots).window.rs(Windows,WindowConfig's runtime half),tray.rs,menu.rs,popover.rs,matrix.rs,point.rs, the shortcuts, the Quick Look parts, the badge and the window icon.App's builder methods for them (window,size,tray,menu,popover,stay_in_tray,shortcut,matrix,icon, …), andPrepared's matching fields.- The routes that act on a window (
/__window/*, Quick Look, the popover) answer "this build has no window" withoutgui, rather than not compiling, so the router stays one piece.
The window's description (WindowConfig's label, path, scope and
abilities) stays, because a window's scope is part of the IPC security
model that TestShell exercises.
What stays without gui
The router, the guard, the protocol, TestShell, the client ids
(Clients keyed by an opaque id instead of tao's WindowId), the event
bus, live queries, the inspector's data, codegen, --mcp, rata check's
ELYRA_CHECK, migrations and seeders, and the exit hooks of RFC 0053.
App::run without gui
It still runs every headless mode (ELYRA_CODEGEN_OUT, ELYRA_MIGRATE,
ELYRA_SEED, ELYRA_CHECK, ELYRA_BUNDLE_INSPECT, --mcp). Otherwise
it returns Error::Config("this build has no window: elyra's gui feature is off") instead of opening one. A CLI calls App::prepare() and uses
its Ctx, or --mcp.
Calling commands without a page
Prepared gets call(name, args) -> Result<Value>, the same dispatch
(middleware, validation, abilities against the app's own grants) the
router uses, for a CLI that wants its commands by name. A CLI can also call
the Rust functions directly. call is for a tool that takes a command name
from its own arguments (open question 3).
Testing
- CI: a Linux job on a runner without the webview packages builds
and tests
elyrawith--no-default-features --features database,http,backend,secrets,ai,updater,sidecar. If anything still pulls in GTK, the build fails at link time. cargo hack --each-feature-style checks for the features that implygui, so each combination compiles.- A small
examples/cli.rs: prepare, call a command, print. It's built and run in that job. - The existing suites run unchanged with the defaults.
Implementation plan
httpas a direct dependency; the IPC layer stops namingwry::http.Clientskeyed by an opaque id. This is a no-op refactor that lands first.- The features and optional dependencies.
#[cfg(feature = "gui")]on the modules,Appmethods andPreparedfields above, and the no-window answers for window routes. App::runwithoutgui;Prepared::call.- The CI job, the example, docs (
getting-started, a "Without a window" section inarchitecture.md, the feature table in the README andconfiguration.md), CHANGELOG.
Open questions
Answered in Decisions.
guias a default feature, or explicit? Recommendation: default. Every app today has a window, andcargo addshould keep giving one. A CLI opts out withdefault-features = false, which is the usual Rust way to ask for less.systemwithout dialogs: split it so a CLI keepsopen, clipboard, notifications anddirswithoutrfd(GTK on Linux)? Recommendation: not now:systemimpliesgui. Notifications and the clipboard need a desktop session anyway. A CLI that wantsdirsuses the crate. If a headless use for part ofsystemturns up, it gets its own feature then.Prepared::callby name: worth it, or should a CLI call the Rust functions? Recommendation: add it. It's a thin wrapper over the dispatch the router has, and it gives a CLI the app's middleware, validation and abilities. Calling the function directly skips all three, which is right for some tools and wrong for others.- The crate's docs on docs.rs-style builds: document every feature
together (
--all-features), ascargo docin CI already does. Recommendation: yes, with#[cfg_attr(docsrs, doc(cfg(feature = "gui")))]on what needs it, so the docs say what needs a window.
Not in this RFC
- A headless browser (rendering pages without a window).
elyra-macrosandelyra-dbchanges: neither depends on the window.rataitself, which is a separate binary and already has no webview.
Alternatives considered
- Splitting the crate (
elyra-core+elyra): a cleaner line, but every app's imports and every doc page would move, for what a feature gives without either. - The CLI depends on
elyra-dbalone: works for the database, but not for the commands, the container, the updater or MCP, which is what ElyraSQL shares.
As built
As designed, with these specifics:
App's builder methods stay withoutgui: the window, tray, menu and popover methods only configure, and without a window nothing reads what they set. So an app and its command-line twin can share oneApp::new()…builder, which is what ElyraSQL needs, andPrepared's fields stay too.tray,systemandshortcuts, whose crates need a desktop, turnguion.- Two stand-ins in
window.rs:NativeId(tao'sWindowIdwith the window, an empty enum without) andProxy(tao'sEventLoopProxy, or an empty enum whosesend_eventcan't be called). The code that only passes them along (Windows, the dev endpoint,Clients) compiles unchanged.Windowsis never bound without a window, so a route that acts on one finds none, as it would in a test. - What's behind
gui:shell/webview.rs(the event loop), and in debug buildsshell/picture.rsandshell/dev.rs;App::run_window(the part ofrunthat opens the loop);wry::webview_versionin the diagnostics; the agent's script inTestShell::page_scripts. The optional dependencies aretao,wry,muda(also its general entry, which made GTK a dependency on Linux),webkit2gtk,gio,cairo-rs, theobjc2crates andwebview2-com. httpashttp-types(http_typesin the code): the IPC layer andTestShellname it rather thanwry::http, andelyra::testing::httpre-exports it. The integration tests use that.- Lints without
gui: much of what serves the window is unreachable there, so the crate allowsdead_code,unused_imports,unused_variablesandunreachable_codein that configuration only. The default build, with the window, is held to-D warningsas before; the headless CI job runs clippy with-D warningstoo. - No
doc(cfg): nothing public is behindgui(decision 4 had nothing to mark), and the features that need a window already say so. Prepared::callis generic over the result (serde_json::Valuefor a twin that prints it) and refuses an ability the app doesn't grant its page, with the guard's message.- Tests:
framework/tests/headless.rs(calls by name, an ability refused and granted, an unknown command, bad arguments, andrunwithout a window) runs in both configurations. The whole suite passes withoutgui(--features database,http,backend,secrets,ai,updater, sidecar,autostart,microphone);dev_agent.rsneeds the window. CI'sheadlessjob installs only D-Bus, ALSA, OpenSSL and pkg-config, checks the tree for tao, wry, muda, GTK, WebKitGTK, rfd, tray-icon and global-hotkey, and runs clippy, the tests andexamples/cli.rs.
Decisions
guiis a default feature; a CLI opts out withdefault-features = false.systemimpliesguiand isn't split now.Prepared::call(name, args), through the router's dispatch (middleware, validation, abilities).- The docs say what needs a window, with
doc(cfg(feature = "gui")).