The HagalazOS desktop is an absolutely-positionedDocumentation 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.
div#desktop that covers the full viewport. Desktop icons are laid out on a discrete 80 px grid: each cell is exactly one icon wide and one icon tall. Apps declare themselves to the system by pushing a descriptor object onto window.Apps[]; the window.onload boot routine in script.js iterates that array to render each icon.
Grid system
Three constants govern the layout:| Constant | Value | Meaning |
|---|---|---|
GRID_SIZE | 80 | Width and height of each grid cell in pixels |
GRID_COLS | 10 | Maximum number of columns per row |
occupiedCells | Set<string> | Tracks cells already in use as "x,y" keys |
Automatic placement: findNextFreeCell()
When an app descriptor does not specify gridX/gridY, findNextFreeCell() scans the grid in row-major order — y from 0 to 49, x from 0 to 9 — and returns the first cell whose key is absent from occupiedCells. The chosen cell is immediately added to the set before returning, so the next call receives the subsequent free cell.
The grid supports up to 500 cells (10 columns × 50 rows). If every cell is occupied,
findNextFreeCell() returns { x: 0, y: 0 } as a safe fallback and the new icon overlaps whatever is already in the top-left corner.App descriptor
Each entry inwindow.Apps[] is a plain object with the following fields:
Unique identifier. Becomes the
id attribute of the .window-wrapper DOM element. Also used as the key in the minimizedWindows record. Must be unique across all registered apps.Human-readable label shown in the window’s 7.css title bar and beneath the desktop icon.
Determines the visual glyph on the desktop icon and taskbar button. If the value contains the substring
"bi-", it is treated as a Bootstrap Icons class and wrapped in <i class="bi {icon}">. Any other string is rendered as plain text inside a <span>.Path to the primary HTML document fetched by
loadAppIntoWindow. Can be a relative path (e.g. ./apps/calculator.html) or an absolute URL.Optional secondary URL tried if
htmlPath fails. Useful for hosting the same app HTML on a CDN as a reliability fallback. Omit or set to null if not needed.Zero-indexed column at which to pin the icon. Must be used together with
gridY. When omitted, findNextFreeCell() determines placement automatically. The pinned cell is not automatically added to occupiedCells, so manually-placed icons should use coordinates that do not conflict with auto-placed ones.Zero-indexed row at which to pin the icon. Must be used together with
gridX.When
true, a button for this app is appended to the #taskbar element in addition to the desktop icon. Defaults to false (button is not created) if the property is absent.Icon rendering
The boot loop creates onediv.desktop-icon per app entry and positions it absolutely:
"bi-":
openWindow(app.id, app.htmlPath, app.title, app.fallbackUrl).
Desktop icon CSS
Desktop icon appearance is defined indesktop.css:
- Container —
.desktop-iconisposition: relative,width: 80px,display: inline-flex,flex-direction: column,align-items: center. - Icon glyph —
iinside.desktop-iconrenders atfont-size: 36pxwithz-index: 1to sit above the highlight layer. - Highlight pseudo-element —
.desktop-icon::beforeplaces a64 × 64 pxrounded rectangle (border-radius: 12px) centred behind the icon usingbackground: rgba(255, 255, 255, 0.1)atz-index: 0. This creates the subtle glass highlight visible on hover. - Label — the
spanbelow the icon useswhite-space: nowrap,overflow: hidden, andtext-overflow: ellipsisto truncate long app names to the 80 px cell width.
Wallpaper
The desktop wallpaper is applied as a full-viewport pseudo-element instyle.css:
hagallcdn GitHub CDN repository and fills the entire viewport at cover scale. Because it is on body::before with z-index: -1, both #desktop and #windows naturally appear in front of it without any additional stacking context adjustments.
Runtime app sideloading via drag-and-drop
dragjs.js adds dragover and drop listeners to #desktop. When a .js file is dropped onto the desktop, dragjs.js reads it with FileReader and passes the text content to eval(). This allows app registration scripts — files that push onto window.Apps[] — to be loaded at runtime without modifying os.html.