Writing apps
App structure, assets and tests
Every native SpectreOS application lives in its own crate under codes/apps/<app>/ and follows a uniform directory layout so tooling (spectre-xtask, debug-bhoo-app.py, packaging, and Wisp's Freedesktop launcher) works identically across all apps.
#Standard directory layout
codes/apps/<app>/
├── .cargo/
│ └── config.toml # Uniform per-app Cargo aliases (dev, release, test-web, ...)
├── assets/
│ ├── org.spectreos.<App>.desktop # Required Freedesktop Desktop Entry v1.5 file
│ └── ... # Icons, PNG/SVG art, keyboard layouts, static JSON data
├── test/
│ ├── web-tests.json # Reusable input/state test buttons for `cargo test-web`
│ └── ... # Future test suites (fixtures, UI/IPC/snapshot tests)
├── src/
│ ├── lib.rs # Shared libbhoo UI, pages, state, and host interface
│ ├── main.rs # Standalone Wayland entry point (when applicable)
│ └── ...
├── Cargo.toml
├── Cargo.lock
└── README.md#assets/ and .desktop entries
Every SpectreOS app must ship its Freedesktop Desktop Entry v1.5 file inside codes/apps/<app>/assets/ using reverse-DNS naming (org.spectreos.<App>.desktop), alongside any app icons, images, or static asset files.
Keeping .desktop entries inside assets/ keeps the crate root clean and puts all installable non-code resources in one predictable directory for Nix/OS packaging and Freedesktop discovery (Desktop Entry Specification).
#Required fields
| Key | Requirement | Notes |
|---|---|---|
Type | Application | Standard desktop application entry |
Version | 1.5 | Matches Wisp's Desktop Entry v1.5 parser (codes/apps/wisp/src/freedesktop.rs) |
Name | User-visible title | Displayed in Wisp's App Drawer, Overview, and Settings → Apps |
GenericName / Comment | Short description | Used for launcher search and Settings app details |
Exec | Executable name | Binary installed on PATH (e.g. spectre-settings, spectre-files) |
Icon | Theme icon or app ID | Prefer org.spectreos.<App> or a standard XDG icon theme name |
Terminal | false | Native libbhoo GUI apps do not launch inside a terminal |
Categories | Semicolon-delimited | Freedesktop menu categories (e.g. Settings;System;, System;FileManager;) |
Keywords | Semicolon-delimited | Improves App Drawer search matching |
StartupWMClass | org.spectreos.<App> | Must match the Wayland xdg_toplevel app_id so Wisp links windows to icons |
- For shell or system daemon apps that should not appear as launchable icons in the App Drawer (such as Wisp itself or the SpectreOS on-screen keyboard), add
NoDisplay=true(validate entries withdesktop-file-validate assets/*.desktop). - For file or MIME handlers (such as Calendar
.icsfiles), declareMimeType=(e.g.MimeType=text/calendar;).
Example (codes/apps/settings/assets/org.spectreos.Settings.desktop):
[Desktop Entry]
Type=Application
Version=1.5
Name=SpectreOS Settings
GenericName=System Settings
Comment=Configure SpectreOS display, notifications, lock screen, network, and device preferences
Exec=spectre-settings
Icon=org.spectreos.Settings
Terminal=false
Categories=Settings;System;
Keywords=settings;preferences;wifi;bluetooth;display;notifications;lock;battery;storage;about;
StartupNotify=true
StartupWMClass=org.spectreos.Settings#test/ directory
Every SpectreOS app keeps its non-unit test suites, fixtures, and browser debugger scenarios inside codes/apps/<app>/test/ rather than at the crate root so additional test categories (integration harnesses, golden fixtures, D-Bus/portal test scripts, snapshot baselines) have a dedicated home as the app grows.
test/web-tests.json: JSON array of input, D-Bus, viewport, theme, and state-assertion test cases automatically loaded bycargo test-webat/__debug/testsand validated bycargo test-web-check. See Web debugging for the full step schema and assertion operators.- Rust unit tests: Keep fast unit tests inside
src/(#[cfg(test)]) and run them withcargo app-test. - Future test suites: Add subdirectories or fixtures inside
test/(for exampletest/fixtures/,test/dbus/,test/snapshots/) without cluttering the crate root or shipping test data into production binaries.
#Current SpectreOS apps
#Checklist for adding a new SpectreOS app
- Create
codes/apps/<app>/withCargo.toml,src/lib.rs, and (for standalone Wayland apps)src/main.rs. Keep UI and state separate from host OS services. - Create
codes/apps/<app>/assets/org.spectreos.<App>.desktop(Desktop Entry v1.5) and place icons or static media underassets/. - Create
codes/apps/<app>/test/web-tests.jsonwith smoke-test cases for key views, inputs, and state assertions. - Add
codes/apps/<app>/.cargo/config.tomland register the app in tools/spectre-xtask/src/main.rs (see Cargo commands). - Wire the debug-only WASM feature in tools/bhoo-web-debug/ (see Web debugging) and run
cd codes/apps/<app> && cargo test-web-check. - Follow the first-frame and worker-thread rules in Responsiveness.