AQUA Layout is a programming language for AQUA. It is used to interface with AUI to design apps that keep a uniform resemblance with the rest of the apps and system and is meant to be as simple and as easy to understand as possible. It is not designed to be used for developping games and other apps in the same vein. There is a Github repository which contains all of the current applications in AQUA.
The structure of AQUA layout is very simple; there are only two commands. The “new” commands and the “modify” command. These are represented as + and * respectively, followed by a space then the element/attribute name followed by another space and arguments each separated by spaces. The “new” command adds an element to the screen and the “modify” command changes certain attributes of the following elements. Strings are surrounded by quotes. They can have “placeholders” instead of normal text (see placeholder section). Colours can either be a colour name or “white” for default system colour depending on the current theme or a hexadecimal colour code followed by a “#”. Here are some examples:
- + title “This is a title”
- * colour red
There are also comments, denoted by either “#” or “#~”. They make the compiler ignore everything on that specific line.
Elements ( + )
- title: Adds a title. Takes one argument denoting the text it contains.
- label: Adds a subtitle. Takes one argument denoting the text it contains.
- small: Adds small text. Takes one argument denoting the text it contains.
- paragraph: Adds a paragraph in the same font as the “small” element, but it wraps around at the end of the line making it ideal for big blocks of text. Takes one argument denoting the text it contains. “\n” will force it to wrap around to the next line.
- button: Adds a button. Takes one argument denoting the text it contains. Note that as of now, you can not make an action take place on a click, but in the future this will have a second argument denoting a script to be run on a click.
- space: Adds a space. Takes no arguments.
- categorizer: Adds a line to categorize parts of the app. Takes no arguments.
Attributes ( * )
- colour / color: Changes the colour of the following elements. Takes one argument denoting the colour to change to.
- bg-colour / bg-color: Changes the background colour of the following elements. Takes one argument denoting the colour to change to.
- align: Aligns all of the following elements to either left, right or mid. Takes one argument denoting the side to align to. Note that this may screw up paragraphs if not set to “left”.
- pack: Generally, elements in a layout application are laid out in the order they are added in. Pack allows you to choose from which element to start drawing, or 0 to restart drawing from the beginning. Takes one argument denoting the element to start drawing at.
String placeholders are specific strings that will be replaced at run-time to some other string. For example, if I wanted to have a title with the weather description, I would write down, for example:
+ title "weather description"
If I were to run this, the text in the title would not be “weather description”, but rather the current weather description, like, for example, “overcast clouds”. Here is a list of all the string placeholders currently:
- system location: Gets replaced by the current system location.
- aqua news: Gets replaced by the current news from a Firebase server.
- aqua news-title: Gets replaced by the title of the current news from a Firebase server.
- aqua version: Gets replaced by the current version of AQUA.
- weather description: Gets replaced by a description of the current weather.
- weather temperature: Gets replaced by the current temperature.
- weather main: Gets replaced by a really small description of the current weather.
- weather colour/weather color: Gets replaced by a colour matching the current weather (bluish grey for rain, grey for clouds, yellowish white for snow, …).
- weather invert-colour/weather invert-color: Gets replaced by the opposite of “weather colour/weather color”. Generally used as a text colour.
- time digital: Gets replaced by the current digital time.
- time date: Gets replaced by the current date.
- cpu name: Gets replaced by the CPU name.
- cpu tsc: Gets replaced by yes (the CPU supports TSC) or no (the CPU does not support TSC).
- cpu sse: Gets replaced by yes (the CPU supports SSE) or no (the CPU does not support SSE).
- cpu stepping: Gets replaced by the CPU stepping count.
- cpu vendor: Gets replaced by the name of the CPU vendor (Intel, AMD or other).
- ram size kb: Gets replaced by the amount of RAM in KB.
With the AQUA 1.3, a huge feature was introduced. A programming language (AQUA Script) and a text editor. On this page, I will be teaching you to make your very own programs in AQUA Script!
DISCLAIMER: AQUA Script is not yet a full programming language, and thus is very limited. Same with the editor. They are both in early versions and have not much been tested or at all for that matter.
The AQUA Script has a simple structure. You only need to know a few components. The rest is just knowing tricks and memorizing commands.
Each line can start with as many tabs / spaces / newlines as you want. All lines are composed of arguments and are terminated by a semicolon. Arguments are separated by as many spaces as you want.
The first argument is the command, and the others give a “description” of the command (example: sleep 5; “sleep” is the command, and “5” is the amount of seconds the computer will wait).
If you want to include spaces in your argument, then you have to specify the beginning and the end of it with quotes (example: print “Hello world!”; “Hello” and “world!” are stuck together when written in the log. If I didn’t put any quotes, it would only write “Hello” and ignore the “world!”). These are called groups. If you want to insert a newline, do \n. For a tab, \t, for a semicolon, \c, for a quote, \” and for a backslash, \\.
Arguments can also be stored. To store an argument, do “new $name is argument;”. They can be called in a command with the “$name“. This will replace the”$argument_name” with what is inside (example: new $arg is “Hello world”; print $arg; ). The argument can be a number, in which case you can do maths on it. These are called variables.
That’s all you need to know for the structure.
Here is a list of all the commands and what they do. When explaining the syntax,  means optional stuff, <> is the variable argument and () is a comment. If you are searching for a specific command, type Ctrl+F.
new (or var)
Makes a new variable. The syntax is “new (or var) $<variable_name> is (can also be =) [information on the variable];“
if (or ?)
Compares two values. The syntax is “if (or ?) <a> <comparator> <b> <another command that is executed if the comparing of a and b is successful>;“. Here are the different comparators = (or ==) means a is equal to b, ! (or !=) means a is not equal to b, <= means a is less or equal to b, >= means a is greater or equal to b, < means a is less than b and > means a is greater than b.
if-string (or ?-string or if-str or ?-str)
Same as if, just that is compares strings (groups) instead of numbers. Also only has the = (or ==) and ! (or !=) comparators.
All the graphical commands syntax.
- graphics init → initialize the graphics
- graphics wash (or fill) <red> <green> <blue>; → fill the entire screen with a certain colour (defined by the RGB values).
- graphics rect <x> <y> <width> <height> <red> <green> <blue>; → draw a rectangle on the screen.
- graphics line <x1> <y1> <x2> <y2> <red> <green> <blue> → draw a line from position (x1; y1) to position (x2; y2).
- graphics text (or locate or print) <text> <x> <y> <red> <green> <blue> → draws text on the screen.
- graphics width $<variable name> → set the value of the given variable to the width of the screen.
- graphics height $<variable name> → does the same as with “graphics width” but with the height instead.
All the event (user inputs) commands, like hitting a key on the keyboard or the position of the mouse.
- event key (or key-down or key-press) $<variable name> → polls the keyboard and sets the variable’s value to the id of the last key pressed.
- event key-up (or key-release) $<variable name> → polls the keyboard and sets the variable’s value to the id of the lased key released.
- event key-map $<variable name> → converts the id of the key in the variable to a character.
- event mouse-down (or mouse-press) $<variable name> → sets the variable to the button of the mouse last pressed (0 for none, 1 for left, 2 for middle and 3 for right).
- event mouse-click (or mouse-up or mouse-released) $<variable name> → sets the variable to the button of the mouse last released (0 for none, 1 for left, 2 for middle and 3 for right).
- event mouse-x $<variable name> → sets the variable to the x coordinate of the mouse cursor on the screen.
- event mouse-y $<variable name> → sets the variable to the y coordinate of the mouse cursor on the screen.
Does a mathematical operation on two values and puts the result into a variable. The syntax is “do <value 1> <operation> <value 2> is $<result>;“. Here are all the operations. + means plus, – means minus, * means times, / means divided, % (or mod) means modulo, << (or left) means left shift, >> (or right) means right shift, or (or |) means or, and (or &) means and, xor (or ^) means exclusive or.
|| (or abs)
Replaces the variable with it’s absolute value. The syntax is “|| (or abs) $<variable>;”.
Adds one to the variable. The syntax is “++ $<variable>;”.
Subtracts one to the variable. The syntax is “– $<variable>;”.
put (or =)
Sets the value of a variable. The syntax is “put (or =) <value> to (or ->) $<variable>;”.
type (or trans)
Transforms the variable from integer to string or from string to integer. The syntax is “type (or trans) $<variable> to (or ->) integer (or int or string or str);”.
print (or log)
Writes string or variable to log. The syntax is “print (or log) $<variable> (or <argument / argument group>) [as] [int] (or integer or str or string);“.
Waits for a certain amount of seconds. The syntax is “sleep <seconds>;”. Note that this command does not count the seconds starting from when it was called, but from the last second recorded by the CMOS chip.
Sets the value of the given variable to the time. The syntax is “time $<variable>;”.
rand (or random)
Sets the value of the given variable to a pseudo random number between two values. The syntax is “rand (or random) <min> <max> [to] (or ->) $<variable>;”.
exit (or stop)
Stops the program. The syntax is “exit (or stop);”.
run (or exec or goto)
Go to a command and continue running the program from there. The syntax is “run (or exec or goto) <command number>;“. Note that this is the command number and NOT the line number. Start from zero.
Opens any application currently on the system. The syntax is “open <application name>;”.
Pauses the program and reads what the user types in. The program resumes once the user has hit the enter key. The syntax is “read $<variable name>;”.
Here are some suggestions for your first post.
- You can find new ideas for what to blog about by reading the Daily Post.
- Add PressThis to your browser. It creates a new blog post for you about any interesting page you read on the web.
- Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.