Quick start
Generate the application
With cargo-generate installed, no checkout is needed:
cargo install cargo-generate
cargo generate --git https://github.com/jigonzalez930209/egui-workbench \
--subfolder templates/app --name my-app
cd my-app
cargo runFrom a checkout, use the repository task so the dependency points at your tree:
git clone https://github.com/jigonzalez930209/egui-workbench
cd egui-workbench
cargo xtask new ../my-app --name my-app --title "My App"
cd ../my-app
cargo runBoth paths copy templates/app and replace the NaN, , and placeholders. xtask new also fills the local path, and the result is a standalone Cargo workspace that compiles without changes.
my-app/
├── Cargo.toml # dependency and lints
├── rust-toolchain.toml
├── rustfmt.toml
├── clippy.toml
├── src/
│ ├── main.rs # window and run_native
│ ├── app.rs # App state, handle(Command), close guard, save_tab
│ ├── appearance.rs # density, corners, text size, brand accent
│ ├── commands.rs # Command, keymap, palette rows
│ ├── model.rs # Tab + TabData, the per-tab model
│ ├── content.rs # the product screen seam
│ ├── ui.rs # WorkbenchApp panels and overlays
│ ├── panels.rs # demo inspector and output panels
│ ├── settings.rs # persisted appearance preferences
│ ├── gallery.rs # demo-only component gallery
│ ├── charts.rs # demo-only charts
│ ├── chart_settings/ # demo-only plot configuration UI
│ └── icon_browser.rs # demo-only icon browser
└── assets/
├── logo.svg # product mark
├── icons/ # app icon sizes (when you add them)
└── ui-icons/ # extra 24×24 monochrome glyphsWhat runs
- An undecorated window with a custom title bar, File/View/Help menus, and window controls.
- A navigator listing eight example sections; each opens a closable tab.
- An editor column with tabs, a placeholder gallery, and a status bar.
- Settings with Appearance (theme, follow system, reduced motion) and Shape (density, corners, text size, brand accent).
- A command palette, keyboard menu, demo dialogs, toasts, and Save / Discard / Cancel prompts for both the window and dirty tabs.
- An optional inspector (right) and output panel (bottom), toggled from View.
- Appearance preferences stored atomically in the platform config directory.
Replace the demo
The starter is deliberately domain-neutral. Three seams matter:
| File | Replace |
|---|---|
src/model.rs | TabData: the state one tab owns. |
src/content.rs | The placeholder screen: call your product UI here. |
App::save_tab in src/app.rs | Persistence; the stub only clears the dirty flag. |
Delete gallery.rs, charts.rs, chart_settings/, and icon_browser.rs when they are no longer useful, and adapt DemoState in model.rs.
Keep the shell
ui.rs already implements WorkbenchApp. You can replace everything inside the central method without touching the title bar, tabs, palette, settings, or close guard.
Add a command
Every feature starts as a command:
- Add a variant to
Commandinsrc/commands.rs. - Add a shortcut to
keymap()(longer chords first). - Add a row to
palette_items(). - Add a menu item in
src/ui.rsundertitle_bar. - Add an arm to
App::handleinsrc/app.rs.
The same command is then reachable by pointer, keyboard, and search.
Run the checks
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo testFrom the workbench repository, cargo xtask check runs the same gate for the library and cargo xtask template-check regenerates this application and compiles it.
Next: Build your first app explains the runtime by building it without the template.