HagalazOS discovers every application through a single shared array,Documentation Index
Fetch the complete documentation index at: https://mintlify.com/linuxfandudeguy/HagalazOS/llms.txt
Use this file to discover all available pages before exploring further.
window.Apps. On window.onload, script.js iterates over every entry in that array, places a clickable icon on the desktop grid, and optionally adds a button to the taskbar. Opening an icon fetches the app’s HTML file, wraps it in a sandboxed blob <iframe>, and presents it inside a draggable, resizable window — no build step or server-side runtime required.
How the registration system works
Whenos.html loads, script.js runs the following sequence:
- It checks whether
window.Appsexists. If the array is empty or undefined, the boot function returns early and the desktop stays blank. - For each descriptor in
window.Apps, it resolves the icon’s grid position. IfgridXandgridYare provided as numbers, the icon is placed at that exact cell. OtherwisefindNextFreeCell()scans the grid column-by-column, top-to-bottom, until it finds the first unoccupied80 × 80 pxcell. - A
.desktop-iconelement is created and positioned absolutely inside#desktop. Ifapp.iconis defined and contains"bi-", a Bootstrap Icons<i>element is rendered; otherwise the string is displayed as plain text. - If
app.taskbaristrue, a matching<button>is appended to#taskbar. - Clicking either the desktop icon or the taskbar button calls
openWindow(id, htmlPath, title, fallbackUrl).
What openWindow() does
openWindow() first checks whether a <div id="…"> matching the app’s id already exists in the DOM:
- If it does and is hidden (minimized): it is made visible again and brought to the front.
- If it does and is visible: it is simply raised to the top
z-index. - If it does not exist: a new
.window-wrapperdiv is created, appended to#windows, and made draggable. The app’s HTML is then fetched fromhtmlPath. On success the raw HTML text is turned into aBlob URLand loaded inside a<iframe>— isolating the app from the host page. If the primary fetch fails andfallbackUrlis set, that URL is tried next. If both fail, an error message is shown inside the window body.
App descriptor shape
Every app is described by a plain JavaScript object. Push one ontowindow.Apps before window.onload fires (i.e., before or inside a <script> that runs synchronously in os.html).
Descriptor fields
A unique identifier for the app. Used as the
id attribute of the window’s <div> element. If two apps share the same id, calling openWindow() for either one will reuse the single existing window element instead of creating a new one.The text shown in the window’s title bar and, if
taskbar is enabled, as the accessible label of the taskbar button.A Bootstrap Icons class name (e.g.
"bi-calculator-fill") or any arbitrary string. The check uses optional chaining — if icon is undefined, no <i> element is rendered. When the value is defined and contains "bi-", an <i class="bi {icon}"> element is rendered at 28 px. Any other string — including plain text or an emoji — is rendered inside a <span> directly.The path or URL to the app’s HTML file. This is fetched at window-open time and rendered inside a sandboxed blob
<iframe>. It should be a complete, self-contained HTML document — all assets it needs must either be inlined or fetched from an absolute URL, because relative paths inside the blob iframe won’t resolve against the host origin.An optional secondary URL. If the fetch of
htmlPath fails (network error or non-2xx status), openWindow() tries this URL instead. Pass null or omit the field to skip fallback behaviour.The zero-indexed column at which to place the desktop icon. The boot code checks this with a strict
typeof app.gridX === "number" test — a string value or undefined falls back to auto-placement. Must be used together with gridY. The grid is 10 columns wide (GRID_COLS = 10).The zero-indexed row at which to place the desktop icon. Used only when
gridX is also a number. If omitted, auto-placement via findNextFreeCell() is used instead.When
true, a button for this app is added to the #taskbar element alongside the desktop icon. Clicking it calls openWindow() with the same arguments as the desktop icon.Registering a custom app step-by-step
Create your app HTML file
Write a standalone HTML document for your app and save it, for example as
apps/notepad.html. Because it will be rendered inside a blob <iframe>, inline all CSS and JS you need, or reference them via absolute URLs.Create a JS descriptor file
Create
apps/notepad.js. It should initialise window.Apps if necessary and push your descriptor:Add the script tag to os.html
Open The order matters:
os.html and add a <script> tag for your new descriptor file before the closing </body> tag, after script.js has already been included:script.js must load first because it defines openWindow() and the boot window.onload handler.