Intro
Sacred OS is an operating system that runs in your web browser and is written in vanilla JavaScript. Sacred OS uses a bootloader so you can use the OS with your saved settings, programs, files, etc. Sacred OS is inspired by operating systems from the Windows 9x era. It is open source, and the code can be found here.
How it works
Sacred OS runs off a JavaScript object which is essentially the "hard disk". The GUI, the kernel, programs, and more are all stored here. The bootloader writes to this object either by uploading a disk backup or by fetching all the necessary files and storing them (what happens when you boot from a fresh install).
In Sacred OS, HTML files are executable. When you execute an HTML file, it is loaded into a window which
contains an iframe of the HTML file. These HTML files can communicate with the kernel, such as requesting
the system's main style sheet or writing to the disk. Communication to the kernel from program iframes is
accomplished through the window.postMessage()
method.
List of Kernel Commands (Incomplete)
Command | Function |
---|---|
ALERT:[ | Makes an alert to the user that they must acknowledge before continuing. The message for the alert is after the left bracket. |
DEL[ | Deletes a file or folder with the specified path after the bracket. |
MK:D[ | Makes a directory (folder) in the specified path after the bracket. |
MK:F[ | Makes an empty file in the specified path (including the file name) after the bracket. |
MK:MENU-SC[ | Adds the file path after the left bracket to system/menuShortcuts.json , which
holds a list of all files on the start menu. After the path has been added to the JSON file, the kernel
adds
the program associated with the path to the start menu. |
REQ:AF | Sends a request to get all files on the virtual hard disk disk. The kernel, upon recieving this
message
will
send the entire disk encoded using JSON.stringify() . The message string is prepended with
AF:
|
REQ:OSV | The kernel will send the current version of the OS to the iframe sending the message in the format:
OSV:1.1 .
|
REQ:SS | The kernel will send the entire system CSS style sheet, system/gui.css encoded as
a string to the iframe (program) that sent
the message. The string containing the style sheet is prepended with SS: |
RND:[] | The kernel will rename the folder in the path inside the brackets to the text specified after the right bracket. |
RNF:[] | The kernel will rename the file in the file path inside the brackets to the text specified after the right bracket. |
U:DSKTP-BG[ | Applies a new desktop background from the specified path after the left bracket.
system/settings.json is then updated with the new path.
|
U:TF[12h | Changes the OS's clock to the 12 hour time format. |
U:TF[24h | Changes the OS's clock to the 24 hour time format. |
Planned Features
- Desktop shortcuts
- Videogame emulators
- Linux-like terminal that can execute JavaScript code
- Cut, copy, paste, and drag 'n drop functionality for files
Change Log
Version | Changes |
---|---|
1.8 |
|
1.7 |
|
1.6 |
|
1.5 |
|
1.4 |
|
1.3 |
|
1.2 |
|
1.1 |
|
1.0 | Includes all previous untracked changes. This is the first tracked version. |
Q&A
Q: What inspired you to make Sacred OS?
A: Daedal OS actually inspired me. I thought it was
really
incredible that a Windows 10-like desktop environment could be coded inside a webpage. I saw that it was
recieving
a lot of attention and thought, "hmmm, I can do that too and put it on my resume". I didn't want to totally
copy
what Dustin Brett did, and I thought I could possibly do what he did but better in some ways. So I came up
with
the idea to make a retro Windows inspired operating system written with vanilla JavaScript that would allow
you
do
save and backup your data more easily. I chose to use Vanilla JS as opposed to a framework because it would
allow
me to have more access to low level features in JavaScript, giving me more code control, and potentially
more
performance.
Q: Are there file size limits for the JSON disk backups and the virtual hard drive?
A: Yes, and they are determined by the browser. The virtual hard drive is a JavaScript
object.
I
can't find much information on how large an object can be in the main modern browsers, but a developer forum
for
Chromium has a post from 2010 saying Chromium has a
limit
of
2GB. I can't find anything on the max size for saving files in JavaScript either, but I wouldn't be
suprised
if such a limit existed, it would be at least 1GB for Firefox and Chrome. For saving anything to local
storage,
the limit in most browsers is 5MiB, but Firefox and Chrome allow users to increase the limit.
Q: Why is orange the main color of Sacred OS?
A: Its my favorite color 😁.