Table of Contents

  • Intro
  • How it works
  • List of Kernel Commands
  • Planned Features
  • Change Log
  • Q&A
  • Credits
Sacred OS Logo

About Sacred OS

Table of Contents

  • Intro
  • How it works
  • List of Kernel Commands
  • Planned Features
  • Change Log
  • Q&A
  • Credits

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.18
  • Icons in files.html have been reworked to have a more consistent design with the rest of the OS.
  • Custom program icons now show in files.html
  • jsNES now has an option for EPX pixel art upscaling.
1.17
  • The start menu now has a maximum height, and you can scroll through installed programs if you have a lot of them.
  • Added the "contain" desk background mode.
1.16
  • You can now zoom in on pictures in the image viewer.
  • Fixed bug where folder names and file names could be created with brackets. These characters are incompatible with the kernel.
1.15
  • Taskbar buttons now have program icons.
  • The settings program now correctly displays the current desktop baground mode after reopening the program.
  • jsNES has better NES screen scaling options.
1.14
  • Sacred OS now has an NES emulator!
  • To go along with the emulator I've included a copy of D-Pad Hero 2.
1.13
  • The app store now has a search feature.
  • When starting notepad without a file open, when you create a new file then save changes to that file through notepad.html
1.12
  • Sacred OS now has a save file as feature! Try it out in notepad.
1.11
  • Fixed various bugs with file/folder operations, and have implemented unit tests to prevent them from showing up again.
  • Fixed bug where if it is 12:00 am, the time showed at 00:00 am.
1.10
  • Fixed a bug where files could be created with an empty name through a kernel command.
  • Sacred OS now has unit tests.
  • You can now jump to directories in files.html
1.9
  • Fixed a bug where folder and file labels were not consistently centered.
  • Fixed a bug where folders were not created in the right location three levels deep from the root folder.
  • Prevented folders from being created with no name (empty string).
1.8
  • Folders and directory buttons in the file explorer have an improved design.
  • Names for files and directories break to the next line if they are too long.
  • The border on windows is slightly thicker, allowing window resizing to be easier.
1.7
  • HTML files in the file explorer now have a unique icon.
  • Files can now be opened in notepad itself.
  • The file opened in notepad or the image viewer is reflected in the program header text.
  • File and folder deletion in the file explorer is now more similar to how files and folders are deleted in Windows.
1.6
  • If programs don't have an icon, they will have the default icon in the start menu.
  • Impoved the looks of some program icons.
  • Program icons in the start menu now are shown as a consistent width of 27x27px.
  • When a dialog is already shown in the files program and a new dialog is shown, the old dialog is closed.
  • Folders can now be renamed.
1.5
  • Programs have embedded icons that show in the start menu!
1.4
  • The dialog for renaming files has the original file name already populated inside, and it's text highlighted.
  • Image files now have their own icon in the files program.
1.3
  • Fixed security vulnerability where websites visited in Sacred's browser could run kernel commands and methods.
  • Added file renaming functionality.
  • Dialogs and context menus in the files program look nicer.
1.2
  • File upload feature added! You can now import external files into Sacred OS.
  • The image viewer can now show JPG, GIF, and WEBP files.
1.1
  • The kernel code got some refactoring and a marginal performance boost.
  • The kernel can now return the current OS version.
  • The horizontal rule on the start menu (line below program list) now has the same color as the system's border colors.
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 😁.

Credits

  • ARANDOMSITE - Custom Neocities Thumbnail Script
  • Ben Firshman - JSNES Emulator*
  • Diegogagan2587 - Calculator*
  • Erik Houdini - Magic Boy OS
  • Kent Hansen & Andreas Pedersen - D-Pad Hero 2
  • Redux Flakes - Default Desktop Wallpaper
  • simonlc - Tetr.js*
  • TakWolf - Ark Pixel Font (the system font Sacred uses)
  • xrainoxu - Window resize functionality
*Program that has been significantly modified from it's source code.