GopalOS Developer Manual
Intro
GopalOS is a web-based operating system with a JSON-based filesystem and programs such as a File Manager, Text Editor, search engine, and more!
GopalOS File System
Every file in GopalOS is in the following format:
[filename]: {
type: filetype,
content: filecontent,
other: otherMetadata
}
It is required that content
is defined using the syntax content: function() {}
or content: () => {}
and not the content() {}
syntax. The filetype
key has a string value containing the file extension in lowercase (e.g. "txt"
). In GopalOS, there are three directories and one file on the root directory. The /version.var
file contains a string representing the current version string of GopalOS. The other three directories are /home
, /apps
, and /system
, which store user-made files, application files, and system files, respectively. The /version.var
file and the three aforementioned directories are the only items that should be in the root directory.
GopalOS Apps
An app's files are stored in the /apps
directory, with a folder name equal to that of the app ID. For example, File Manager's app ID is "file-manager" and its files are located in /apps/file-manager
. The files in a basic app's (i.e. with a load script and standard window) directory is as follows:
app-id.pgm
: This is the program file, which runs the load script, displays the window, and optionally registers a taskbar icon (to enable minimizing or pinning the program). The file name of the launch program must be the app ID. For example, File Manager's app ID is "file-manager" and its launch program is located at /apps/file-manager/file-manager.pgm
load.js
: This is the file that is usually run on program start. For example, in File Manager, it loads the list of files and displays them.
window.html
: This is the file that contains the HTML markup code for the app's main window. The contents of this file will be inserted into the <div id="windows">
element by the load.js
file.
install.js
: This optional file contains code that will be run when the app is installed (e.g. from Package Installer).
uninstall.js
: This optional file contains code that will be run when the app is uninstalled (e.g. from Application Manager).
An app can also store preferences or other configuration files in the /home/appdata
folder. An app must store these files in the /appdata/app-id
folder (where app-id
is the app's ID). This must be used for user-set options or user-made data only, not for internal program code.
Information about all installed apps is stored in the variable os.apps
. Each entry has the following structure:
[appID]: {
name: appName,
icon: appIcon,
desc: appDescription,
globalID: optionalAppGlobalID,
version: versionString
}
The app name, app description, and app version string are self-explanatory. The icon should be the same as what the app uses in its taskbar icon. The globalID
key is optional; apps installed from the App Center have a global ID in the format Publisher.OptionalCategory.AppName
.