Deno Desktop Shell
Relevant source files
The following files were used as context for generating this wiki page:
The Deno Desktop Shell serves as the thin architectural layer of the OpenHWP project, responsible for providing a native desktop window and environment for the HWP/HWPX document engine. Built using deno desktop (introduced in Deno v2.9.0), it separates platform-specific concerns—such as window management, native menus, and file system access—from the core document parsing and rendering logic.
Sources: README.en.md:5-13, CONTRIBUTING.md:16-18
System Architecture
The architecture follows a strict separation between the "platform shell" and the "document engine." The shell leverages the Deno runtime to serve an application via localhost and display it within a native webview powered by the Chromium Embedded Framework (CEF).
The diagram illustrates how the Deno runtime serves the application to a Chromium-based webview while providing native hooks.
Sources: README.en.md:15-22, README.md:15-22
Core Components
| Component | Description | Implementation Detail |
|---|---|---|
| Desktop Shell | The native wrapper for the application. | Powered by deno desktop. |
| Rendering Backend | The engine used to display the UI. | Chromium (CEF) for cross-platform consistency. |
| Native Bindings | Links between JavaScript and native OS features. | Deno desktop menus and window bindings. |
| Serving Layer | Local web server providing the application content. | Deno.serve() returning the application UI. |
Sources: README.en.md:17-21, README.md:17-21
Rendering and Webview Configuration
OpenHWP explicitly uses the Chromium Embedded Framework (CEF) as its rendering backend. By setting "backend": "cef" in the project configuration, the shell ensures that rendering remains identical across macOS, Windows, and Linux. This specific backend enables modern Web APIs that are critical for the shell's functionality, such as the File System Access API.
# Build a standalone binary with the Chromium (CEF) backend
deno desktop main.ts --backend cef
Sources: README.en.md:18-19, 62-63, README.md:18-19, 66-67
File System Integration
Unlike traditional desktop applications that might require native Deno-side file picker implementations, the Deno Desktop Shell utilizes the standard web-based File System Access API. Because the shell serves the app from localhost (a secure context) via the CEF backend, it can directly invoke native-like file pickers from the browser context.
Interaction Flow
The sequence shows how the shell delegates file selection to the webview's native browser capabilities.
Sources: README.en.md:37-51, README.md:41-55
Development and Build Workflow
The shell is managed through a single Deno toolchain. It does not require Node.js, Bun, or other external managers.
- Requirements: Deno version ≥ 2.9.0 is mandatory for
deno desktopsupport. - Dependency Management: Dependencies are cached using
deno install(configured viadeno.json). - Execution: Development is handled via
deno task dev, which initiates the local server and webview. - Distribution: Standalone binaries and platform-specific installers (
.dmg,.msi,.deb) are generated directly via thedeno desktopcommand.
Sources: CONTRIBUTING.md:11-18, orca.yaml:14-18, README.en.md:62-67
Future Roadmap for the Shell
The shell's evolution is centered on increasing integration with native platform features while maintaining its "thin" nature:
- Native Menu Integration: Mapping application actions to OS-level menu bars.
- Multiple Window Support: Leveraging Deno desktop's ability to spawn and manage multiple native windows.
- Print Path: Implementing a bridge between the webview's print capabilities and native system print dialogs.
- CI/CD Packaging: Automated signing and notarization for various Linux, Windows, and macOS distribution formats.
Sources: README.en.md:71-80, README.md:75-84
The Deno Desktop Shell provides the necessary infrastructure to transform the rhwp document engine into a consumer-ready desktop application, ensuring consistent cross-platform behavior through the CEF backend and modern Web APIs.