Omni Widgets Documentation
website·Indexed 31 days ago
https://omni.2f0.cnA tool app for creating DIY widgets for iOS and HarmonyOS. Documentation covers widget components (Text, Grid, Stack, Gauge, etc.), JS API modules for network requests, file management, device information, and location, as well as the use of placeholders to bridge JS data into components.
What's inside Omni Widgets
- The Canvas component generates graphics based on a set of drawing instructions. It is ideal for creating progress rings, line charts, bar charts, badges, dashboards, and outlined text. It does not execute arbitrary code, ensuring the same instructions work for both editor previews and desktop cards. Note that it does not support direct image drawing in the current version.
Overview of AWidget Markup (AWML)
AWidget Markup (AWML) uses XML-style native component tags to describe widget layouts. Layout source is stored separately from the JavaScript that supplies variables. AWML supports Home Screen, Lock Screen, control widgets, and Live Activities. Tags compile to native layouts, and visual changes in the editor synchronize with the source code.Overview of the Canvas component
The Canvas component generates graphics based on a set of drawing instructions. It is ideal for creating progress rings, line charts, bar charts, badges, dashboards, and outlined text. It does not execute arbitrary code, ensuring that the same set of instructions works consistently across the editor preview and desktop cards.Overview of Omni Widgets for HarmonyOS
Omni Widgets for HarmonyOS allows users to DIY custom home screen and lock screen cards. It provides a visual editor for simple layouts and a built-in JavaScript runtime for complex logic such as fetching API data, reading local files, and conditional styling.Overview of Omni Widgets capabilities
Omni Widgets allows users to create custom iOS widgets without code via a visual editor, or with complex logic using a built-in JavaScript runtime. It supports 9 widget types: home screen (small, medium, large), lock screen (circular, rectangular, inline), Control Center (button, toggle), and Live Activities (Dynamic Island). Key features include a visual editor for components (text, images, SF Symbols, buttons, shapes, containers), JavaScript APIs for network requests, weather, location, health, calendar, and files, and deep system integration via iCloud sync, URL Schemes, and Shortcuts.Overview of Omni Widgets capabilities
Omni Widgets is a tool for creating custom iOS widgets. It provides a visual editor for non-coders and a full JavaScript runtime for developers to create complex, interactive widgets that can fetch network data. Key features include:
- Support for 9 widget types: Home Screen (Small, Medium, Large), Lock Screen (Circular, Rectangular, Inline), Control Center (Buttons, Switches), and Live Activities (Dynamic Island).
- Visual Editor: Drag-and-drop support for text, images, SF Symbols, buttons, shapes, and containers.
- JavaScript Integration: APIs for network requests, weather, location, health, calendar, and file access, as well as control over widget refreshes and Live Activities.
- Data Binding: Uses a placeholder syntax
${variable}to bind JavaScript data to widget components. - System Integration: Supports iCloud sync, URL Schemes, and Apple Shortcuts.
Overview of Omni Widgets for HarmonyOS
Omni Widgets for HarmonyOS allows users to create custom DIY home screen and lock screen widgets. It provides a visual editor for simple layouts and a built-in JavaScript runtime for complex logic such as fetching API data, reading local files, and conditional styling.Overview of AWidget Markup (AWML)
AWidget Markup (AWML) uses XML-style tags to describe widget layouts. It is used for desktop, lock screen, control widgets, and Live Activities. Layout source code is stored independently, while JavaScript continues to provide the data variables. Tags are compiled into native layouts. Note: This feature may be temporarily disabled in some versions, but existing widgets continue to use their saved native layouts.Understand FileManager path conventions and sandboxing
The
FileManageroperates within a sandbox directory specific to each card, with the root path defined aswidgets/{id}/files/. All paths provided to the API are relative to this root.Path Security: To prevent unauthorized access to other cards or system files, the following are forbidden and will be rejected:
- Absolute paths (starting with
/) - Home directory shortcuts (starting with
~) - Parent directory traversal (
..) - Empty segments (e.g.,
a//b) - Backslashes
Path Formats: The API accepts both simple filenames (e.g.,
"foo.png") and paths with thefiles/prefix (e.g.,"files/foo.png"). Internally, the prefix is stripped. However, thewritemethod always returns the canonical form:"files/<name>".- Absolute paths (starting with
Understand supported iOS widget locations in Omni
Omni supports widgets across four primary iOS locations, each with different size options and capabilities (e.g., lock screen widgets do not support full color).Category Type Location Home Screen Small / Medium / Large Home Screen Lock Screen Circular / Rectangular / Inline Lock Screen Control Center Button / Switch Pull-down Control Center Dynamic Island Live Activity Top capsule area Understand FileManager path conventions and sandboxing
The
FileManageroperates within a per-card sandbox directory with the root pathwidgets/{id}/files/. All paths provided to the API are relative to this root.Path Handling:
- The API accepts both simple filenames (e.g.,
"foo.png") and paths with thefiles/prefix (e.g.,"files/foo.png"). The prefix is stripped internally. FileManager.writereturns the canonical path in the format"files/<name>". This canonical path must be used for thesrcfield of Image components to render correctly.
Security Constraints: To prevent access to other cards or system files, the following are forbidden and will be rejected:
- Absolute paths (starting with
/) - Home directory shortcuts (starting with
~) - Parent directory traversal (
..) - Empty segments (e.g.,
a//b) - Backslashes
- The API accepts both simple filenames (e.g.,
Implement graphics using the Canvas component
The Canvas component renders graphics based on a list of JSON commands. It is suitable for progress rings, line/bar charts, badges, and dashboards. It does not execute arbitrary code, ensuring consistent rendering across the editor preview, home screen widgets, and Live Activities.