HagalazOS ships a small companion script,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.
dragjs.js, that turns the desktop surface into a live plugin loader. Instead of editing os.html and adding a new <script> tag every time you want to try an app, you can write a self-contained .js file, drag it onto the open browser window, and have the code execute immediately — no reload, no build step.
How drag-and-drop loading works
dragjs.js runs as an immediately-invoked function expression (IIFE). On execution it looks for the #desktop element and attaches two event listeners to it:
| Event | Behaviour |
|---|---|
dragover | Calls e.preventDefault() to signal to the browser that drops are accepted on this target. |
drop | Calls e.preventDefault(), then iterates over every file in e.dataTransfer.files. |
file.type === 'application/javascript' or file.name.endsWith('.js'). Files that fail both checks are skipped with a warning — console.warn is emitted with the exact message:
runJSFile().
Inside runJSFile()
FileReader.readAsText() reads the file’s contents as a UTF-8 string. Once the read completes, reader.onload fires and the full text of the file is passed directly to eval(). The execution happens synchronously inside the onload callback, in the same JavaScript context as the rest of os.html. This means the dropped script has full access to:
window.Apps— it can push new app descriptors.openWindow()— it can open a window immediately, without waiting for a desktop icon click.- The entire DOM — it can create elements, manipulate the taskbar, read existing windows, etc.
Executed {file.name} to the console. Any runtime error during eval() is caught and logged as Error running {file.name}: <error>; the rest of the page continues to function normally.
window.onload fires once, shortly after the page first renders. If you drop a plugin file after window.onload has already run, pushing onto window.Apps will update the array but the boot code that renders desktop icons won’t run a second time — so no new icon will appear until you reload os.html. If you need the icon to appear without a reload, call openWindow() directly in your plugin script to open the app window immediately, bypassing the icon-creation step entirely.Writing a droppable app plugin
A plugin is just a.js file that pushes a descriptor onto window.Apps. Keep it self-contained — no imports, no dependencies beyond what is already on the page.
openWindow() call:
Steps to use drag-and-drop loading
Write a .js plugin file
Create a
.js file on your local machine that pushes an app descriptor onto window.Apps and, optionally, calls openWindow() to open it immediately.Open HagalazOS in GUI mode
Launch
os.html (or ossingle.html) in your browser. Make sure the desktop area is visible — the #desktop element must exist in the DOM for dragjs.js to attach its listeners.Drag and drop the .js file onto the desktop
Drag your
.js file from your file manager or desktop and drop it anywhere over the HagalazOS desktop surface. The browser will trigger the drop event on #desktop, dragjs.js will validate the file extension, read it with FileReader, and execute it via eval().Check the browser console (F12 → Console) — a successful execution logs: