- ships with node 20
- supports macos >= catalina (dropped in v33)
- supports standard css scrollbar styling (previous versions that do have an annoying menu color bug)
editor: add mod + f to focus tree search
code editor: fix nasty bug when focusing field using tab key
editor: f2 focuses "html" property when "label" is not present
This allows creating a new empty session. This is useful for projects
that want to dynamically create the entire session using a custom module.
Without this, you can also create an empty session json file and load
that with `--load`, but then you would have to manage that file, and if
you accidentaly press control-s, it gets overwritten to contain any
dynamically created widgets.
With this commit, such a custom module can just create a new session on
startup and then populate it. This takes a bit of fiddling to get the
order of events correct, this commit also adds an example showing how to
do this.
This allows modules to re-initialize any state they need whenever the
module is reloaded.
Without this, any such initialization can also be done in the top
level of the custom module, but this has two problems:
1. Top-level module code runs on load and reload, and for the initial
load, it runs *before* the connections are set up, so trying to use
send() would produce an error on load (not reload).
2. Top-level module code runs for the primary custom module, but also
for any nested modules, removing control about the process and
ordering from the primary custom module. In addition, a module that
can be used both as primary and nested module, there is no clean way
to distinguish between these cases.
Both of these problems can be solved by doing some bookkeeping in the
global object, but that produces messy code.
This commit allows modules to define a reload() function, which is
called (for the primary module only) after the module is reloaded. This
means that any initialization for the first load can be done in init()
and for reloads in reload(), and in both cases all connections will
already have been set up solving issue 1. In addition, neither of these
functions are called for nested modules, solving issue 2 (and the
primary module can then stil explicitly call a reload function on nested
modules if needed, as shown in the examples).
The unload method is actually called on all modules, not just the main
one, so it makes no sense to have the module merger example call it
explicitly on its submodules.
This applies to errors in e.g. the oscInFilter defined by a custom
plugin module. Previously, just the exception backtrace was shown,
without any indication of the exception type or where the error
occurred, e.g.:
(ERROR, UDP) links is not defined
With this commit, the full exception including backtrace is printed,
making debugging a lot easier, e.g.:
(ERROR, UDP) ReferenceError: links is not defined
at CustomModule.oscInFilter (/app/custom-module.js:221:83)
at OscServer.oscInFilter (/open-stage-control/app/server/src/server/osc/index.js:148:1)
at OscServer.oscInHandler (/open-stage-control/app/server/src/server/osc/index.js:162:1)
at OscServer.oscInHandlerWrapper (/open-stage-control/app/server/src/server/osc/index.js:174:1)
at osc.UDPPort.emit (node:events:394:28)
at Object.osc.firePacketEvents (/open-stage-control/app/server/node_modules/osc/src/osc-transports.js:25:1)
at osc.UDPPort.p.decodeOSC (/open-stage-control/app/server/node_modules/osc/src/osc-transports.js:85:1)
- @{} syntax not returning truncated value according to the widget's precision property (fixed for primitive values only, object values are still returned as is)
-> the clone widget was already watching for its target widget-created events and updating accordingly,
thus causing concurrent attempts to update its children, errors and memory leaks
- If you have a suggestion, open a feature request
- If you have a question or want to share your experience with other users, please use the dedicated forum at https://openstagecontrol.discourse.group/
"postinstall":"echo '\\033[36m=> Dependencies installed successfully. Run \"npm run build\" to build the assets.\\033[0m\n'",
"start":"electron app/",
"build":"npm run build-css && npm run build-js && node scripts/copy-assets.js && echo '\\033[36m=> JS and CSS assets built successfully. Run \"npm run package\" to build an executable or \"npm start\" to run the app.\\033[0m\n'",
"build":"npm run build-css && npm run build-js && echo '\\033[36m=> JS and CSS assets built successfully. Run \"npm run package\" to build an executable or \"npm start\" to run the app.\\033[0m\n'",
Widgets can use each other's properties values and update automatically when they change by using this syntax.
- `id`: the target widget's `id`
- `property`: is the target widget's property name
#### Value
The property name (and the dot) can be omitted and defaults to `value` (`@{widgetId}` => `@{widgetId.value}`). `value` always resolves to the target widget's current value, not its `value` property
#### `this`&`parent`
A widget can fetch its own properties or its direct parent's by using the keywords `this` or `parent` instead of `id`. When `this` or `parent` can be used, using the target widget's `id` instead won't work.
####Dynamic properties
Some properties, when changed, trigger a complete widget recreation that ends any ongoing user interaction. Also, updating these properties continuously (e.g. when linked to a slider's dynamic value) can be very cpu expensive.
Some properties have much cheaper update routines and can be considered as `dynamic`, as in performance safe. These properties are marked in the documentation with a <iclass="dynamic-prop-icon"title="dynamic"></i>.
#### Circular references cases
- container widgets can inherit their children's properties only to define `dynamic` properties
- widgets can inherit their own `value`<iclass="dynamic-prop-icon"title="dynamic"></i> property only to define `dynamic` properties
#### Object properties
If the retreived property is an object (`{}`) or an array (`[]`), a subset can be retreived directly by appending a dot and a key (array index or object key) : `@{parent.variables.key}`
#### Nesting
The inheritance syntax supports 1-level nesting : `@{fader_@{toggle_1}}`
This syntax allows listening on an osc address to define a property.
- `address`: osc address to listen to; if the leading slash (`/`) is omitted, the address will be prefixed with the widget's `address` property
- `default` (optional): default value returned before any message is received
- `usePreArgs` (optional): by default, osc listeners inherit the widget's `preArgs` and (these must be matched for the osc messages to be processed). Set to `false` bypass them.
#### Dynamic address
The `address` can contain `@{}` blocks
## Javascript: `JS{{ <code> }}`
This syntax allows writing formulas in pure javascript. The code will be compiled as a function and executed in a restricted context.
- if no `return` statement is found, the formula will return an empty string
- javascript [strict mode](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Strict_mode) is always enabled
- `setTimeout` and `setInterval` functions are not available
- the `global` object is shared between all javascript formulas (changing its properties *does not* trigger any synchronisation even if the value is used somewhere else)
In this context, `@{} / OSC{}` are seen as variables, not as the value they hold,
Parsing errors can be read in the DevTool console (F12).
## Formulas: `#{}`
!!! warning "Deprecated"
This syntax is now deprecated and will be removed in the future, sessions using it will be working for a few more versions but users are strongly encouraged to migrate to the javascript syntax.
The following syntax allow writing mathematical formulas in widgets' properties:
```
#{FORMULA}
```
Where FORMULA is a valid [MathJS](http://mathjs.org/docs/expressions/syntax.html) expression:
- strings can be multiline when enclosed in backticks instead of double quotes (``` `` ```)
Additionnal functions:
- `indexOf(a, x)`: returns index of item `x` in array `a`
- `unpack(x)`: remove an array's brackets (`unpack([1,2])` returns `"1, 2"`)
- `pad(x, padding)`: add leading zeros if the length of the integer part of `x` is smaller than `padding` (`pad(1,2)` returns `"01"`)
- `length(x)`: returns the length of an array or string
- `keys(x)`: returns an array of a given object's property names (from [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys))
- `values(x)`: returns an array of a given object's own enumerable property values (from [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values))
- `extend(x, y)`: merges two objects into one
!!! tip ""
A single widget property can contain multiple formulas. Variables and functions declared in a formula are available to subsequent formulas in the same property definition.
Client options can be set either with the server's `--client-options` option, or per client by adding query parameters to the server's url. One must prepend the url with a question mark (`?`) followed by `parameter=value` pairs separated with ampersands (`&`).
| noFocus | 1 / 0 |0 | (built-in client only) prevent the client window from taking focus |
| clientSync | 1 / 0 |1 | set to 0 to prevent the client from syncing with other clients |
| altTraversing | 1 / 0 |0 | set to 1 to enable an alternative traversing behavior for toggle buttons (traversing gestures on toggle buttons will change their values in only one way depending on the first touched button's state) |
| virtualKeyboard | 1 / 0 |0 | (desktop only) set to 1 to enable the virtual keyboard by default |
| notifications | 1 / 0 |1 | set to 0 to hide notifications by default |
| title | string |'' | replace window title |
| noWarning | 1 / 0 |0 | set to 0 to disable unsaved session warnings |
This program is a free software released under the [GNU/GPL3](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/LICENSE) license.
## Dependencies
Open Stage Control relies on several other free softwares, including [Node.js](https://nodejs.org/), [Electron](http://electron.atom.io/), [osc.js](https://github.com/colinbdclark/osc.js), [babel](http://babeljs.io/), [browserify](http://browserify.org), [exorcist](https://github.com/thlorenz/exorcist), [express](http://expressjs.com), [node-sass](https://github.com/sass/node-sass), [jQuery](http://jquery.com/), [jQuery-UI](http://jqueryui.com/), [Font Awesome](http://fontawesome.io/), [stacktracejs](http://stacktracejs.com), [mathjs](http://mathjs.org/). A comprehensive and up-to-date list can be found [here](https://github.com/jean-emmanuel/open-stage-control/network/dependencies).
Open Stage Control relies on several other free softwares listed in [package.json](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/package.json).
The default theme was based on [Nord](https://www.nordtheme.com/), some UI components were inspired by the text editor formerly known as Atom (now [Pulsar](https://pulsar-edit.dev/)).
- `settings.read`: `function(name)`, see [settings.js](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/server/settings.js#L55-L103) for available options
- `app`: an [event emitter](https://nodejs.org/api/events.html#events_class_eventemitter) for monitoring the events sent by the different clients. Event names can be found in [callbacks.js](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/server/callbacks.js), callbacks are called with 2 arguments: `data` (object) and `client` (object: `{address, id}`)
- `options`: `array` containing the extra options passed to `--custom-module` after the filename
- `loadJSON`: `function(path)` loads a json file (path is relative to the custom module location)
- `saveJSON`: `function(path, object)` save an object/array to a json file (path is relative to the custom module location)
`sendOsc` and `receiveOsc` expect arguments formatted as follow:
- `address`: `string`
- `args`: `array` of `{type: "OSC_TYPE_LETTER", value: VALUE}``objects`
- `host`: `string` ip address, valid hostname or `midi`
- `port`: `integer` port number or `string` midi device name
`send` and `receive` are shorthands for `sendOsc` and `receiveOsc` that don't require args to be formatted as objects (numbers are casted to floats by default):
Custom modules don't let you use node's `require` function at runtime, but you can manage your sources in multiple files and bundle them into a single file before loading it in Open Stage Control.
The common pattern for this is using the [browserify](http://browserify.org/) library:
**1**. define some variable in `number.js`
```javascript
module.exports = 42
```
**2**. retreive it in your main module file (`main.js`):
```javascript
var num = require('./number.js')
module.exports = {
init: function(){
console.log(num) // 42
},
oscInFilter: function(data){
// etc
}
}
```
**3**. bundle your sources into `custom-module.js`:
Using the server's `custom-module` option, users can load a custom javascript module that filters incoming and outgoing OSC / MIDI messages.
##Writing a custom module
```js
// Do whatever you want
// initialize variables
// declare functions
// listen to app events
// load modules
// etc
module.exports = {
init: function(){
// this will be executed once when the osc server starts after
// connections are set up
// it is called for the main module only
},
stop: function(){
// this will be executed once when the osc server stops
// it is called for the main module only
},
reload: function(){
// this will be executed after the custom module is reloaded
// it is called for the main module only
},
oscInFilter:function(data){
// Filter incoming osc messages
var {address, args, host, port} = data
// do what you want
// address = string
// args = array of {value, type} objects
// host = string
// port = integer
// return data if you want the message to be processed
return {address, args, host, port}
},
oscOutFilter:function(data){
// Filter outgoing osc messages
var {address, args, host, port, clientId} = data
// same as oscInFilter
// return data if you want the message to be and sent
return {address, args, host, port}
},
unload: function(){
// this will be executed before the custom module is reloaded
// it is called for all modules, including other loaded modules
},
}
```
##Available globals
The module is executed in a restricted context, only a few globals are available :
----
#### `app`
[`Event Emitter`](https://nodejs.org/api/events.html#events_class_eventemitter), useful for monitoring the events sent by the different clients. Event names can be found in [callbacks.js](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/src/server/node/ipc/callbacks.mjs), callbacks are called with 2 arguments: `data` (object) and `client` (object: `{address, id}`)
Send osc/midi message to connected clients. `host` and `port` can be specified to simulate a specific origin for the message.
- `host` (optional): `string` ip address, valid hostname or `"midi"`
- `port` (optional): `integer` port number or `string` midi device name
- `address`: osc address
- `args`: value or `{type: "OSC_TYPE_LETTER", value: VALUE}``object` (objects that don't match this format will simply be turned to a JSON string).
- `options` (optional): set to `{clientId: id}` to define which client receives the message (where `id` is the client's id as retrieved from `app` events or `oscOutFilter`)
For convenience, `host` and `port` can be provided both as single string argument joined with a colon.
----
#### `send(host, port, address, ...args)`
Send osc/midi to a target (see `receive()`).
----
#### `settings.read(name)`
Returns specified server option. `name` must be the option's long name without the leading dashes (ie: `"send"`, not `"s"`)
----
#### `settings.appAddresses()`
Returns the server's http addresses.
----
####`loadJSON(path, errorCallback)`
Loads a json file (path is relative to the custom module location)
- `path`: `string`, path to file (any extension allowed, but the content must be valid JSON)
- `errorCallback` (optional): `function`, called with the error as argument if the file can't be loaded
----
####`saveJSON(path, data, errorCallback)`
Saves an object/array to a json file (path is relative to the custom module location)
- `path`: `string`, path to file (any extension allowed)
- `data`: `object`, `array` or any value that can be encoded to JSON
- `errorCallback` (optional): `function`, called with the error as argument if the file can't be loaded
----
####`require(path)`
Load another javascript module. Returns the value of `module.exports` defined in this module. If `path` is a relative path, it will be resolved against its parent module's path. See [Managing Big Modules](../managing-big-modules).
This function is different from node's native `require` function, it's merely a way to split a custom module into separate files.
----
#### `nativeRequire(moduleName)`
This function can be used to load native node modules or locally installed modules (e.g. with npm) if a `node_modules` folder is found in the custom module's location.
Raw access to the server's [TCP backend](https://framagit.org/jean-emmanuel/open-stage-control/-/blob/master/src/server/node/osc/tcp.mjs). Can be used to monitor the state of TCP connections:
```js
for (var ip in tcpServer.clients) {
tcpServer.clients[ip].port.on('ready', ()=>{
console.log(`TCP connection established with ${ip}:${tcpServer.clients[ip].remotePort}`)
})
tcpServer.clients[ip].port.on('close', ()=>{
console.log(`TCP connection lost with ${ip}:${tcpServer.clients[ip].remotePort}`)
})
}
```
#### `restartMidiBackend()`
This function can be used to restart the midi backend (if already running) without restarting the server
#### Other javascript globals
- `console`
- `setTimeout`
- `clearTimeout`
- `setInterval`
- `clearInterval`
- `__dirname`
- `__filename`
- `process`
- `global`
----
## Autoreload
Custom modules (including submodules loaded with `require()`) are reloaded automatically when they are modified. Upon reload, timers (`setTimeout` and `setInterval`) and event listeners (added to the `app` object) are reset. After each reload the `module.exports.reload()` function (if any) is called.
The `global` object persists accross reloads.
??? "Reloading native modules"
When using modules loaded with `nativeRequire()`, you may need to tell the custom module how to unload some components to allow reloading using the `module.exports.unload` definition. For example, if a port is bound using the `http` module, you'll need to unbind it otherwise the custom module will fail to bind it again when reloading:
```js
var http = nativeRequire('http'),
server = http.createServer((req, res)=>{
res.writeHead(200)
res.end('Hello world')
})
server.listen(5555, 'localhost')
module.exports = {
unload: function() {
server.close()
// otherwise you'd get "Error: listen EADDRINUSE: address already in use 127.0.0.1:5555"
Hit ++f12++ to open the developers tools panel. The html/css inspector helps retrieving the class names needed to style specific parts of the widgets: hit ++ctrl+shift+c++ or click on the inspect icon () and click on a element in the interface to reveal its html code.
## Inline syntax
For simple use cases, the `css` property can be written as a HTML inline styles (without any CSS selector). CSS rules will apply to the widget element.
```css
opacity: 0.5; /* make the widget's transparent */
opacity: 0.5; /* make the widget transparent */
font-size: 120%; /* increase font-size */
```
@ -21,17 +27,17 @@ CSS selectors can be used to apply styles to specific elements:
*/
}
.label {
/* style for the .label elements */
label {
/* style for the label elements */
}
> .label {
/* style for the direct child .label element */
> label {
/* style for the direct child label element */
}
```
!!! warning ""
!!! info ""
Mixing Inline and Selector syntaxes doesn't work, once you use selectors, you have to use the `:host` selector to target the widget element.
## Extra css classes: `class`
@ -39,23 +45,16 @@ CSS selectors can be used to apply styles to specific elements:
This non-standard css property can be used to add custom css classes to the widget element: `class: my-custom-class;`
Multiple classes can be added (one per `class` statement). Custom classes are always added to the widget's root element, css selectors are ignored.
!!! warning ""
!!! info ""
Using class names that are already used in the app can be hazardous. In order to avoid that, custom class names should be prefixed with something uncommon and preferably cool, such as `xxx-myclass` or `crispy-seitan-myclass`.
## Layering: `z-index`
Z-Axis ordering can be set using the `z-index` rule. Absolutely positionned widgets (when `top` or `left` is different from `auto`) have `z-index:10;` by default.
## Layering: `pointer-events`
To make a widget ignore interactions (ie to be able to click through it), add `pointer-events:none;`.
!!! note ""
This is always ignored when the editor is enabled.
Z-Axis ordering can be set using the `z-index` rule. Widgets positioned at absolute coordinates (when `top` or `left` is different from `auto`) have `z-index:10;` by default.
## Responsive sizing
In most cases, using percentages in `height` and `width` will do. CSS `calc()` function can help in some cases (set the corresponding property to `auto` to avoid conflicts):
In most cases, using `vertical`, `horizontal` or `grid` layouts as well as using percentages in `height` and `width` will do. CSS `calc()` function can help in some cases (set the corresponding property to `auto` to avoid conflicts):
```css
:host {
@ -86,22 +85,16 @@ Media queries can also be used:
- use `%` for font-size
##CSS Variables
##CSS variables
CSS Variables declared in the [default theme](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) can be overriden. Some widgets also use specific CSS variables (mostly to define colors) documented on their respective pages.
[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) declared in the [default theme](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) can be overridden.
##Other tips
Widgets also rely on CSS variables for the style properties (colors, padding, etc). These are documented in the widgets' `css` property description.
#### Use the inspector
# Loading images
Hit `F12` to open the developers tools panel. The html/css inspector helps retreiving the class names needed to style specific parts of the widgets.
#### Panel's background-color
This works for panel, strip and tabs:
```css
> .panel {
background-color: red;
}
```
Image urls are resolved in this order:
- in the session's directory
- in theme's directory
- in the server's `remote-root` directory if the option is set
Themes can be loaded with the `--theme` option. Multiple themes can be combined. Built-in themes can be loaded using their name, custom theme files can be loaded using their path.
Available themes (full color scheme):
- `nord`: arctic color palette (https://www.nordtheme.com/)
- `orange`: grey and orange theme
## Creating a custom theme
Creating a custom theme is as simple as writing a tiny css file that will override the default css variables defined in [default.scss](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) :
```css
:root {
--color-accent: red;
}
```
This will change the default accent color to red. Variables can also be overridden for a specific subset of elements, for example :
```css
.panel-container {
--color-accent: blue;
}
```
This will change the default accent color to blue for all elements in panel widgets.
## Autoreload
Theme files are reloaded automatically when they are modified.
## SCSS
If you want to use the [SCSS](https://sass-lang.com/documentation/syntax) syntax to write your theme, follow the [Running from sources](../../getting-started/running-from-sources) instructions, create a `.scss` file in `src/scss/themes/` and run `npm run watch-css`. The theme will be watched and compiled automatically to a css file located in `app/assets/themes/` (css files in this directory can be selected from the theme option by their name, without .css suffix).
The session editor can be enabled from the sidepanel. Once enabled, clicking on a widget will make it the *selected widget*.
## Root panel
The root panel can be selected by clicking on the "Root" button in the sidepanel.
## Context menu
Right clicking / long touch on a widget or on a tab will also display a context menu providing useful utilities :
- `Edit parent`: select widget's parent for edition
- `Copy`: copy widget's data
- `Cut`: copy widget's data and delete selected widget
- `Wrap in`: wrap the widget in a new container
- `Paste`: paste copied widget in selected container
- `Paste`: paste the widget as is
- `ID + 1` : increments the id of the copied widget (and all its children) before pasting
- `Clone` : create a clone widget targetting the copied widget
- `Add widget`: create a new widget in selected container
- `Add tab`: create a new tab in selected container
- `Delete`: delete selected tab or widget
## Open / Save
By default, sessions are saved and opened on the server's filesystem. When saving a session opened by mutliple clients, these will reload the session file automatically.
!!! note
It is possible to limit this feature to specific client addresses by using the server's `--remote-saving` option. For example:
Will disable remote saving except for the clients with ip addresses `127.0.0.1` (the server's local address) and `192.168.0.10`.
## Import / Export
Sessions can be exported/imported on the device's filesystem, doing so has a few limitations:
- the session's name won't appear in the window's title
- the session won't be added to the session history
## Grid
By default, widget resizing / dragging snaps to a 10 pixel wide grid. Its width can be customized in the editor (when it's enabled). Setting its width to 1 will disable it. Note that the grid doesn't affect manual setting of a widget's size / position.
## Properties
Selected widget's properties are displayed and can be modified in the sidepanel. The [widgets reference](/docs/widgets-reference) section lists the available properties for each widget type. Property fields are all multiline (press `shift + enter` for new line).
Properties are written in JSON, with some flexibility brought by the [JSON5](https://github.com/json5/json5) format. For example, doubles quotes around object keys are not mandatory. All input will be converted to standard JSON.
## Widget resizing / dragging
Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle. Using this feature will convert position and size values to plain number values, thus breaking previously set percent or inherited values.
## Keyboard shortcuts
The following shortcuts are always available:
| Shortcut | Description |
|---|---|
| `mod + e` | enable/disable editor |
| `mod + s` | save session |
| `mod + shift s` | export session as... |
| `mod + o` | open a session file |
The following shortcuts are available only when the editor is enabled:
| Shortcut | Description |
|---|---|
| `mod + click`* | Multi-widget selection. Widgets can be toggled from selection by clicking on them individually.|
| `shift + click + drag`* |Draw a selection rectangle and attempt to select widgets in it (starts by selecting the widget under the cursor). If `mod` is pressed too, current selection is kept and will be merged with the new one if possible. |
| `f2` |Edit selected widget's label |
| `mod + z` |Undo |
| `mod + y / mod + shift + z` |Redo |
| `delete` (`backspace` on Mac) |Delete selected widgets |
| `mod + c` |Copy selected widgets |
| `mod + x` |Cut selected widgets |
| `mod + v` |Paste clipboard in selected widget |
| `mod + shift + v` |Paste and increment id |
| `up, down, left, right` |Move selected widgets (1 grid unit, hold `shift` for 5 grid units) |
| `alt + [up, down, left, right]` | Resize selected widgets (1 grid unit, hold `shift` for 5 grid units) |
| `mod + a` | Select current widget's siblings and itself |
Prebuilt binaries for Linux, Windows and OS X can be found on the [release](https://github.com/jean-emmanuel/open-stage-control/releases) page.
## Supported platforms
Open Stage Control is a *desktop* server application. It runs on all [platforms supported by Electron](https://electron.atom.io/docs/tutorial/supported-platforms/) or [Node](https://nodejs.org/en/) (in headless mode only, see [Running without Electron](#running-without-electron)). Any device running a compatible browser can connect to the server :
- Chrome/Chromium version `50` or later (Linux, MacOS, Windows, Android, etc)
- iOS version `9.3` or later
!!! tip "Android / iOS native app ?"
There is no native mobile application. The server's url can be added to the home screen to launch the interface in fullscreen.
## Options
Below are the available command-line options. Note that when running without any command-line switch (ie from a file browser), a launcher window will spawn to help setting them.
!!! tip ""
Preferences are stored in the user's home folder in a file named `.open-stage-control` (hidden under Linux / macOS)
||Option |Description |
|---||---|
| `-s` | `--send`| default targets for all widgets (ip:port / domain:port / midi:port_name pairs) |
| `-l` | `--load`| session file to load |
| | `--state`| state file to load (osc messages will be sent, unless there are other clients connected) |
| `-b` | `--blank`| load a blank session and start the editor |
| `-c` | `--custom-module`| custom module file to load (custom options can be passed after the filename) |
| `-p` | `--port`| http port of the server (default to 8080) |
| `-o` | `--osc-port`| osc input port (default to --port) |
| | `--tcp-port`| tcp server input port |
| | `--tcp-targets`| tcp servers to connect to (ip:port pairs), does not susbtitute for --send |
| `-m` | `--midi`| midi router settings |
| `-d` | `--debug`| log received osc messages in the console |
| `-n` | `--no-gui`| disable default gui |
| `-g` | `--gui-only`| app server's url. If true, local port (--port) is used |
| `-t` | `--theme`| theme name or path (mutliple values allowed) see [theming](/docs/theming/) |
| `-e` | `--examples`| list examples instead of recent sessions |
# TARGET_PLATFORM can be linux, win32 (windows) or darwin (os x)
export PLATFORM=TARGET_PLATFORM
# TARGET_ARCH can be ia32, x64, armv7l or arm64
export ARCH=TARGET_ARCH
npm install
# run this instead if ARCH is armv7l
# npm install --arch=armv7l
npm run build
npm run package
# Do one of the following if you want a deb package for debian/ubuntu
npm run deb32
npm run deb64
npm run debarm
```
This will build the app in `dist/open-stage-control-PLATFORM-ARCH`.
!!! note ""
Building the app for windows from a linux system requires wine to be installed.*
## Running in a headless context
Electron, Open Stage Control's engine, is based on chromium and can't run out of the box without a display server. However, using a virtual framebuffer does the trick. Detailed instructions can be found in Electron's [documentation](http://electron.atom.io/docs/tutorial/testing-on-headless-ci/).
In short: install [xvfb](https://en.wikipedia.org/wiki/Xvfb) and prepend your command with `xvfb-run`:
```bash
xvfb-run open-stage-control -n
```
## Running without Electron
It is possible to run the server in headless mode without Electron using [node](https://nodejs.org/en/download/package-manager/) (v6 or higher) :
Welcome to Open Stage Control documentation. Along these pages you'll learn how to setup OSC on your system and everything you need to start building your own control interface.
## Overview
Open Stage Control consists of 3 modules: the server, the launcher and the client.
The **server** is the core of the software, it is responsible for sending and receiving all osc/midi messages, and act as a web server that serves the clients web application. It is written in Javascript and runs with Electron, a cross-platform framework based on Chromium. By default, the server always opens a client window when it starts but it can be run in *headless* mode, without any window.
The **launcher** provides a simple way to configure and start the server. It appears whenever the server is not launched from a terminal or without being configured.
The **client** is the web application made available by the server when it starts. Any compatible browser that connects to the server by browsing to its address will create a new client instance and be able to open and modify sessions.
## Requirements
The **server** can run on all [platforms supported by Electron](https://www.electronjs.org/docs/tutorial/support#supported-platforms). Systems that can run [Node.js](https://nodejs.org/en/) may also be able to run it in headless mode (see [Running with Node](./running-with-node.md)).
The **client** is compatible with the following browsers:
Run one of these instead of `npm install` (you can get the system's `arch` by running `uname -m` in a terminal)
```
npm install --arch=arm64
npm install --arch=armv7l
```
!!! info "Updating from sources"
```bash
git pull
npm install
npm run build
```
**Run**
```bash
npm start [ -- options]
```
!!! info ""
A double hyphen (`--`) is used here to tell npm that the options are to be passed to the app.
!!! warning "MIDI support"
When running from sources, MIDI support won't be enabled unless the [MIDI configuration procedure](../../midi/midi-configuration/) for "other systems" is followed.
## Build documentation
In order to make the local documentation available through the server's `--docs` option and the launcher's `Documentation` menu action, an extra step is needed.
```bash
# install docs website theme
python3 -m pip install mkdocs-material
# build docs website
npm run build-docs
```
## Package from sources
Follow the "Run from sources" instructions, then:
```bash
# TARGET_PLATFORM can be linux, win32 (windows) or darwin (os x)
export PLATFORM=TARGET_PLATFORM
# TARGET_ARCH can be ia32, x64, armv7l or arm64
export ARCH=TARGET_ARCH
npm run package
# The node-only package can be built with
npm run package-node
```
This will build the app in `dist/open-stage-control-PLATFORM-ARCH`.
!!! info ""
Building the app for windows from a linux system requires wine to be installed.
## Debian / Ubuntu and RPM installers
=== "Debian / Ubuntu"
```
npm run deb64
```
=== "RPM"
```
npm run rpm
```
## Build script on Mac Silicon
This user-contributed script can be used to build open stage control on recent Macs:
If Electron does not run on your platform, it is possible to run the server in headless mode using [Node.js](https://nodejs.org/en/download/package-manager/).
The **server** can be configured with many options, either from a terminal or with the help of the **launcher**.
## Options
!!! quote ""
#### `send`
Defines the default osc/midi targets. These will be added to the widget's individual targets. Targets must be separated by a space and formatted as follows:
- `ip_address:port`
- `host_name:port`
- `midi:device_name`
!!! quote ""
#### `load`
Path to a session file (.json). All clients connecting the server will load it.
!!! quote ""
#### `state`
Path to a state file (.state). All clients connecting the server will load it.
!!! quote ""
#### `custom-module`
Path to a custom module file (.js).
**WARNING:** custom module can access the file system, use at your own risk.
!!! quote ""
#### `port`
HTTP port for the server (default: `8080`).
!!! quote ""
#### `osc-port`
OSC (UDP) input port (default: `port`).
!!! quote ""
#### `tcp-port`
OSC (TCP) input port.
!!! quote ""
#### `tcp-targets`
TCP servers to connect to. When sending osc messages, if the target matches one of these, TCP protocol will be used instead of UDP. Targets must be separated by a space and formatted as follows:
- `ip_address:port`
- `host_name:port`
!!! quote ""
#### `midi`
MIDI options separated by spaces, MIDI support must be enabled, see [MIDI configuration](../midi/midi-configuration.md).
!!! quote ""
#### `debug`
Print sent and received messages in the console. This may impact performance and should not be enabled in production.
!!! quote ""
#### `no-gui`
Disable built-in client window.
!!! quote ""
#### `fullscreen`
Start the built-in client window in fullscreen.
!!! quote ""
#### `theme`
Theme names or paths. See [Themes](../customization/themes.md).
!!! quote ""
#### `client-options`
Default [client options](../client-options.md), separated by spaces.
Disable built-in client window's gpu blacklist (may improve rendering performance in some cases).
!!! quote ""
#### `read-only`
Disable session editing, and file saving.
!!! quote ""
#### `remote-saving`
Disable file saving for hosts that don't match the regular expression.
Sessions are saved and opened on the server's filesystem. It is possible to limit this feature to specific client with a regular expression. For example, `"127.0.0.1|192.168.0.10"` disables remote saving except for clients with ip addresses `127.0.0.1` (the server's local address) and `192.168.0.10`.
!!! quote ""
#### `remote-root`
Set file browsing root folder. Prevent writing files outside of this folder.
!!! quote ""
#### `authentication`
Restrict access to `user:password` (remote clients will be prompted for these credentials).
!!! quote ""
#### `instance-name`
Server's name on zeroconf/bonjour network. Incremented automatically if not available.
!!! quote ""
#### `use-ssl`
Use HTTPS protocol instead of HTTP (a self-signed certificate will be created)
## Command-line options
The following options can only be set from a terminal.
!!! quote ""
#### `disable-gpu`
Disable hardware acceleration for the launcher window and the built-in client window.
!!! quote ""
#### `inspect`
Enable node inspector.
!!! quote ""
#### `cache-dir`
Override default cache directory (contains browser cache and localStorage data).
!!! quote ""
#### `config-file`
Override default config file location (contains session history and launcher config). Defaults to `cache-dir/config.json`.
!!! quote ""
#### `client-position`
Define the built-in client window position, must be a pair of integers separated by a comma (`x,y`).
!!! quote ""
#### `client-size`
Define the built-in client window size, must be a pair of integers separated by a comma (`width,height`).
!!! quote ""
#### `no-qrcode`
Disable qrcode when the server starts.
!!! quote ""
#### `help`
Show help.
!!! quote ""
#### `docs`
Serve documentation website locally and open it with the system's default browser
!!! quote ""
#### `version`
Show version number.
## Running in a terminal
Options name must be prepended with a double dash (`--`) in a terminal.
To install `python-rtmidi`, run `pip install python-rtmidi` (python 2) in a terminal or `pip3 install python-rtmidi` (python 3).
!!! note "Why an additionnal dependency ?"
Providing cross-platform MIDI support is not trivial, as it requires OS-specific compilation that cannot be automated within Open Stage Control's current packaging workflow. Using a python addon seems to be the best compromise so far : the core app remains easy to build, and the extra dependency is easy to install.
## Setup
When running the app, the `-m / --midi` switch must be set; it accepts the following options (separated by spaces):
- `list`: prints the available MIDI ports to the console; numbers in the first column may be used for `input`/`output` definition below
- `device_name:input,output`: connect to midi ports `input` and `output`; osc messages sent to target `midi:device_name` will be processed as midi events; Multiple devices can be declared. If the `device_name` contains white spaces, the declaration must be enquoted (ie `"spaced name:input,output"`). `device_name` doesn't need to match the actual midi device name, it is just an identifier (see [Widget settings](#widget-settings)).
- `sysex`: parse incomming system exclusive messages (disabled by default)
- `pc_offset`: send program changes with a `-1` offset to match some software/hardware implementations
- `path=/path/to/python`: indicates where to find python or python3 binary in case open stage control doesn't (`Error: spawn python3 ENOENT`)
*Linux only:*
- `device_name:virtual`: creates a virtual midi device with one input port and one output port
- `jack`: use JACK MIDI instead of ALSA (add as extra parameter). `rtmidi` must be compiled with `--jack-midi` flag for this to work.
!!! tip
When using the launcher window, midi devices can be listed by right-clicking and choosing `Midi > List Devices`
## Widget settings
In order to send MIDI messages, a widget must have at least one `target` formatted as follows:
`midi:device_name` (where `device_name` is one of the declared midi devices)
!!! warning
Messages received from a MIDI port only affect widgets that send to this port.
## Supported MIDI messages
!!! warning ""
Define static argument values using the [`preArgs`](/docs/widgets-reference/#preArgs) option in order to complete the respective MIDI message.
#### `/note channel note velocity`
NoteOn event or noteOff if velocity equals `0`.
- `channel`: integer between 1 and 16
- `note`: integer between 0 and 127
- `velocity`: integer between 0 and 127
Example:
A push button might be configured as follows in order to send a MIDI note whose velocity is defined by the button's on/off value:
- `on`: 100 (for noteOn velocity of 100 on button push)
- `off`: 0 (to send a noteOff on button release)
- `target`: ["midi:device_name"] (where device_name is one of the declared midi devices defined during [setup](#setup))
#### `/control channel cc value`
Control change event.
- `channel`: integer between 1 and 16
- `cc`: integer between 0 and 127
- `value`: integer between 0 and 127
Example:
A fader might be configured as follows in order to send a MIDI control message (a volume control in this example):
- `address`: /control
- `pre-args`: [1, 7] (MIDI channel 1, control number 7 generally used as volume control)
- `range`: {"min": 0, "max": 127} (MIDI values are encoded in this range)
- `target`: ["midi:device_name"]
#### `/program channel program`
Program change event.
- `channel`: integer between 1 and 16
- `program`: integer between 0 and 127*
!!! note
\* Some devices / softwares display the `program` value between 1 and 128, thus interpreting `program change 0` as `program change 1` and so on. Enable the `pc_offset` option to make Open Stage Control behave this way.
#### `/pitch channel pitch`
PitchWheel event.
- `channel`: integer between 1 and 16
- `pitch`: integer between 0 and 16383
#### `/sysex msg v1 .. vN`
System exclusive message.
- `msg`: hexadecimal sysex data string of the form `f0 ... f7`. You may include placeholders of the form `nn` which will be replaced by `v1, .., vN` respectively.
- `v1, .., vN`: values encoded as hexadecimal data strings to include in `msg`. Most probably, you will need to sepcify a [custom module](/docs/custom-module/) in order to convert numeric widget values into the required hexadecimal format. In general, this conversion will be different for each manufacturer / device.
For a very simple example, refer to session 'sysex.json' found in the application's sub folder 'resources/app/examples/'. Please remember to adjust the button's `target` to the `device_name` used in your MIDI setup.
Open Stage Control comes bundled with built-in MIDI support if you're using the official package for Linux, OSX or Windows.
=== "Other systems / Node"
Enabling MIDI support on other systems or when building Open Stage Control from sources requires additional softwares to be installed on the server's system:
- Install `python-rtmidi` by executing this command
```bash
python -m pip install python-rtmidi --upgrade
```
## Configuration
The server's `midi` option accepts the following parameters, separated by spaces.
!!! warning ""
If an option contains space characters, it must be quoted.
**`list`**
Print the available MIDI ports to the console when the server starts. This action is also available in the launcher's menu.
**`device_name:input,output`**
Create a virtual MIDI device that will translate OSC messages to MIDI messages
- `device_name` is an arbitrary identifier that can be used as a target by widgets (see [Widget setup](#widget-setup)). It doesn't have to match any device's real name.
- `input` / `output` can be port numbers or strings (as reported by the `list` action). If a string is specified, the first port whose name contains the string will be used (comparison is case-insensitive).
**`sysex`**
Enable parsing of system exclusive messages (disabled by default).
**`mtc`**
Enable parsing of midi time code messages (disabled by default).
**`rpn`**
Enable sending and receiving [RPN/NRPN](https://en.wikipedia.org/wiki/NRPN) controls on as single `/rpn` / `/nrpn` messages instead of 3 or 4 control changes that constitute them.
**`active_sensing`**
Enable parsing of midi active sensing messages (disabled by default). Active sensing messages will be received as sysex.
**`pc_offset`**
Send program changes with a `-1` offset to match some software/hardware implementations
**`note_off_velocity`**
Use `/note_on` for noteOn messages and `/note_off` for noteOff messages instead of the defaut `/note` and velocity 0 for note off.
**`auto_note_off`**
Prevent converting outgoing noteOn messages with velocity 0 to noteOff messages.
**`device_name:virtual`** (*Linux / Mac only*): creates a virtual midi device with one input port and one output port
**`jack`** (*Linux only*): use JACK MIDI instead of ALSA. `python-rtmidi` must be compiled with [jack support](https://spotlightkid.github.io/python-rtmidi/installation.html#linux) for this to work.
**`path=/path/to/python`**
*Only use this if you know what you are doing. This option should not be set when using the official Linux / Windows / OSX packages.*
Indicates where to find python binary in case open stage control doesn't (`Error: spawn python3 ENOENT`).
## Widget setup
In order to send MIDI messages, a widget must have at least one `target` formatted as follows:
`midi:device_name` (where `device_name` is one of the declared midi devices)
Its `address` and `preArgs` properties must be set according to Open Stage Control's [midi messages](../midi-messages) specification.
!!! warning
Messages received from a MIDI port only affect widgets that send to this port.
## Debug
Enabling the server's `debug` options will print some extra information (sent/received midi messages, midi setup information, etc)
## Example configuration
Setting the server's `midi` option as follows:
```
sysex synth:1,2 daw:3,3
```
- enables sysex support (sysex messages will not be ignored)
- creates a midi device "synth" connected with input 1 and output 2
- creates a midi device "daw" connected with input 3 and output 3
If a widget has its `target` set to `midi:synth`, it will receive MIDI from port 1 and send MIDI to port 2.
Define static argument values using the [`preArgs`](/docs/widgets/properties-reference/#preArgs) option in order to complete the respective MIDI message.
----
#### `/note channel note velocity`
NoteOn event or noteOff if velocity equals `0`. Incoming noteOff events will be received as `/note` with velocity 0 if `note_off_velocity` is not set during [setup](../midi-configuration).
- `channel`: integer between 1 and 16
- `note`: integer between 0 and 127
- `velocity`: integer between 0 and 127
!!! example "Example"
A push button might be configured as follows in order to send a MIDI note whose velocity is defined by the button's on/off value:
- `on`: `100` (for noteOn velocity of 100 on button push)
- `off`: `0` (to send a noteOff on button release)
- `target`: `midi:device_name` (where device_name is one of the declared midi devices defined during [setup](../midi-configuration))
----
#### `/note_off channel note velocity`
NoteOff event with any velocity. Incoming noteOff events will be received as `/note_off` if `note_off_velocity` is set during [setup](../midi-configuration).
----
#### `/control channel cc value`
Control change event.
- `channel`: integer between 1 and 16
- `cc`: integer between 0 and 127
- `value`: integer between 0 and 127
!!! example "Example"
A fader might be configured as follows in order to send a MIDI control message (a volume control in this example):
- `address`: `/control`
- `pre-args`: `[1, 7]` (MIDI channel 1, control number 7 generally used as volume control)
- `range`: `{"min": 0, "max": 127}` (MIDI values are encoded in this range)
- `target`: `midi:device_name`
----
#### `/program channel program`
Program change event.
- `channel`: integer between 1 and 16
- `program`: integer between 0 and 127*
!!! info
\* Some devices / softwares display the `program` value between 1 and 128, thus interpreting `program change 0` as `program change 1` and so on. Add the `pc_offset` parameter to the server's `midi` option to make Open Stage Control behave this way.
----
#### `/pitch channel pitch`
PitchWheel event.
- `channel`: integer between 1 and 16
- `pitch`: integer between 0 and 16383
----
#### `/sysex msg`
System exclusive message.
- `msg`: hexadecimal sysex data string of the form `f0 ... f7`.
Instead of a single hexadecimal string, arguments can be separated and defined either as hexadecimal bytes or as integers. When received, system messages are always formatted as a single hexadecimal string.
All widgets that send osc messages respond to the same messages. Additionnaly, Open Stage Control responds to some general osc commands.
When osc messages are received, the default behavior is to update the value of all widgets that match the address and preArgs. Additionally, Open Stage Control clients respond to some general osc commands.
!!! note "Multi-client setup"
These commands are interpreted by each client connected to the server so there might be more than one reply. Using a custom module is the only way to send a message to a single client.
## `/EDIT id options`
----
#### `/EDIT id properties options`
Apply a set of options to an existing widget by replacing the old ones with the new ones.
Apply a set of options to an existing widget by replacing the old ones with the new ones. This ignores the widget's `lock` property. If sent by a custom module using `receive()`, this command will not be prevented by the server's `read-only` option.
- `id`: `string`, widget's `id`
- `options`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge
- `properties`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge
Themes can be loaded with the `--theme` option. Multiple themes can be combined. Built-in themes can be loaded using their name, custom theme files can be loaded using their path.
Available themes (full color scheme):
- `orange`: grey and orange theme
- `light`: light and blue
- `dark`: blue night theme
Available extensions (alternative visual settings)
- `flat`: remove 3d effects
- `alt-buttons`: colorful active buttons
- `responsive-fonts`: bigger texts for bigger screens
## Creating a custom theme
Creating a custom theme is as simple as writing a tiny css file that will override the default css variables defined in [default.scss](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) :
```css
:root {
--color-accent:red;
}
```
This will change the default accent color to red. Variables can also be overridden for a specific subset of elements, for example :
```css
.panel-container {
--color-text:blue;
}
```
This will change the default text color to blue for all elements in panel widgets.
## Scss / autoreload
When running the app [from sources](/docs/getting-started), custom themes can be written in scss:
- the scss file must be located in `src/browser/scss/themes/`
- run `npm run watch-css`
The theme will be watched and compiled automatically to a css file located in app/browser/themes/ (css files in this directory can be selected from the theme option by their name, without .css suffix). If the app is running on default http port, clients will reload the theme automatically.
By default, widgets only expose their value to incoming messages, but there are multiple ways to allow changing any widget property using osc messages as well. In this tutorial we'll explore the different possibilities for exposing the `visible` property of a widget to incoming messages, but it applies to any other property.
## 1. Using a variable widget
Create a variable widget and set up its `address` (and `preArgs` if needed) so that it receives the messages you want to use, and then in your other widget's `visible` property, use the [inheritance syntax](../widgets/advanced-syntaxes.md#inheritance-idproperty) to retrieve the variable's value:
=== "Inheritance syntax"
```
@{variable_id}
```
=== "Inheritance syntax + Javascript"
```js
JS{
// bonus, in case you don't want to use the variable's value as-is
if (@{variable_id} > 0.5) {
return true
} else {
return false
}
}
```
Now the variable's value will determine the visibility of the widget. The `visible` property expects a boolean value (`true` for visible, `false` for invisible) but any [truthy](https://developer.mozilla.org/en-US/docs/Glossary/truthy) / [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) will do (e.g. `1` for visible, `0` for invisible is a sensible choice).
## 2. Using the OSC listener syntax
The [OSC listener syntax](../widgets/advanced-syntaxes.md#osc-listeners-oscaddress-default-usepreargs) might be a more straightforward solution for simple use cases. Writing this in a widget's `visible` property:
=== "Relative address"
```
OSC{show}
```
will listen for messages on address `/widget_address/show` and return the last received value.
If we write this instead:
=== "Absolute address"
```
OSC{/show}
```
the address will be `/show` and won't be prefixed with the widget's address as before.
It is often needed to specify the initial state of the listener (before it receives any message), this is done via the second argument of the listener syntax:
=== "Default value (true)"
```
OSC{show, true}
```
=== "Default value (truthy)"
```
OSC{show, 1}
```
=== "Default value (false)"
```
OSC{show, false}
```
=== "Default value (falsy)"
```
OSC{show, 0}
```
If the widget has any preArgs set, the osc listener will inherit them by default, this means that for a message to change the listener's value it will not only have to match its address but also the widget's `preArgs`, this can be prevented using the third argument of the listener syntax:
=== "Ignore preArgs"
```
OSC{show, 1, false}
```
## 3. Using custom variables
The [custom variable syntax](../widgets/advanced-syntaxes.md#custom-variables-varvariablename-default) connects regular properties and scripting properties (`onCreate`, `onValue`, etc), writing this in the `visible` property:
```
VAR{show}
```
will create a custom variable named `show` scoped to the widget (custom variables do not use a global namespace and multiple widgets may use the same names for their custom variables without conflict). This custom variable can be read and set from any widget scripting property using the [`getVar()` / `setVar()`](../widgets/scripting.md#getvarid-name) functions.
For instance, we could use a variable widget as osc receiver like in the first example of this tutorial and use it's `onValue` script to change the custom variable's value (instead of using the inheritance syntax):
```js
// variable widget onValue
// simply pass received value to the custom variable
setVar('widget_id', 'show', value)
```
The custom variable's initial state can be specified:
```
VAR{show, 1}
```
## 4. Using /EDIT commands
The [`/EDIT`](../remote-control.md) remote control command can be used to modify any widget property in the session, for instance:
```
/EDIT widget_id '{visible: false}'
```
Will hide the widget with id `widget_id`. Note that this is different from the 3 techniques described above in that it actually modifies the session and changes the property value in a destructive way (the property is rewritten, not just its state). When quitting the session after using it a warning indicating the session has unsaved changes will be shown, this can be prevented by appending a extra argument to the message:
Note that the arguments after `widget_id` are sent as strings ([JSON5](https://github.com/json5/json5)-encoded objects), this is because sending plain javascript object over osc is not possible.
## Bonus: custom module
Any of these techniques can be used in conjunction with a [custom module](../custom-module/custom-module.md). Using the `receive()` function allows simulating incoming osc messages and can be used to trigger property changes:
Let's walk through the basic steps to build a simple interface in Open Stage Control, send information to another app, and deploy the interface to remote (even mobile) devices.
Before beginning, you should already have installed Open Stage Control -- see the [Introduction](../getting-started/introduction.md).
Also: This document provides sample patches for SuperCollider, Pure Data and Max/MSP, to receive control data from the Open Stage Control interface. If you do not have any of these tools, I suggest to install [Pure Data](https://puredata.info/downloads/pure-data) because it has the smallest footprint.
## The Launcher
Use your system's application launcher, open the Open Stage Control app. Here, you can configure options for the interface server.
For now, go to the first box ("send") and type in `127.0.0.1:57120`. This will tell the server to send Open Sound Control messages to the same machine where the server is running, on port 57120.
NOTE: For your own applications, you can use any port that is not in use. For this example, I chose 57120 because it is SuperCollider's default UDP port (and I set the Pure Data and Max patches to use the same port, to simplify.)
You don't need to set any other options at this time.
### Addresses and ports
Many users approaching Open Sound Control for the first time get confused about ports. You need to be aware of the FROM and TO addresses. The "send" field in the Launcher should reference the address TO which messages should be sent. In this demo, we are assuming that Open Stage Control and the target app are running on the same machine. So the TO address is localhost: `127.0.0.1`. The "send" box should use the port *on which the target app is receiving messages*. This is typically under control of the target app: 1/ SuperCollider opens 57120 by default; 2/ Pd's [netreceive] object, and Max's [udpreceive], both require the TO port as an argument. So the TO port is your choice, as long as they match.
Open Stage Control sends messages FROM the IP address of the machine where Open Stage Control is running, and from port 8080 (or localhost = `127.0.0.1` if on the same machine). Thus, if the receiving app will filter incoming messages based on address, the filtering address should be the FROM address, port 8080. The target app can also update Open Stage Control's display by sending messages back to exactly this address. So you will see later, in the demo patches, that messages are sent to `127.0.0.1:8080` so that the user's interaction with the target app appears in Open Stage Control as well.
## Starting the server
Click the "play" button near the top left of the window. You should see status messages in the launcher window such as:
```
(INFO) Server started, app available at
http://127.0.0.1:8080
http://your.ip.ad.dress:8080
```
And a new, mostly empty, window will open. This new, larger window is the *client*.
## The client
The client allows you to edit and perform your interface.
The interface design is called a *session*. To create a new session, go to the "three-dots" menu at the top left, and choose Session > New session.
Two new panels are displayed: a project browser, and an object inspector (to set properties). The empty space in the middle is the editor, where you will build the interface.
Let's start with a toggle button. Right-click in the empty editor panel in the middle, and navigate to Add widget > Basics > button. For this demo, we don't need to change anything else: the button defaults to toggle behavior, and the display text is not important for now (although you can change it in the inspector, if you want).
And let's add one more control, to the right of this: Right-click, Add widget > Sliders > fader.

When a widget is selected, you can move it by dragging the top-left handle, and resize it by dragging the bottom-right handle. Let's use these handles to position the fader to the right of the button, and stretch it to be horizontal instead of vertical.

Notice, however, that the fader's value handle is still vertical. To fix this, look in the Inspector at the right, expand "Fader style," and check the "horizontal" checkbox.


By the way: I suggest to keep the widgets closer to the top left, so that they are still visible on a phone screen (later).
When designing an interface for production, you would change other object properties as well. In particular, the Open Sound Control addresses `/button_1` and `/fader_1` are not very descriptive. You would probably want to assign different command paths, in the "osc" tab. As this is just an introduction, we won't do that now.
## Receiving the data
At this time, the interface can already be used: three-dots menu > Editor > "Enabled" (click to disable the editor). (The controls will respond also when the editor is enabled, but you have to click an extra time to select the widget before changing its value.)
To see the effect, launch one of the following apps and open the given patch. The Open Stage Control button should open and close the envelope, and the fader should control frequency. The patches also send control data from their own GUIs back to Open Stage Control, so all of the controls should be synced in both directions.
NOTE: In Pure Data and Max, the default slider/fader range is 0-127, integers. Open Stage Control uses the range 0.0 - 1.0 by default. If you just create a slider and connect it, you won't see much action. In the example patches, the slider's properties have been modified to take a 0.0 - 1.0 floating-point range, matching the data from Open Stage Control.
NOTE: Because all of the patches bind to the same UDP port, you can open only one at a time. You could, if you like, change the port number in one patch, and add that port by specifying multiple "send" targets in the Launcher, e.g. `127.0.0.1:57120 127.0.0.1:7374`.
NOTE: These patches are provided as a courtesy to get you started more quickly. Maintaining, extending or developing them is outside the scope of the Open Stage Control community.
!!! Example "Choose your app"
=== "Pure Data"
Copy the code below, and save it into a text file `osc-first-steps.pd`. Then open it in Pure Data.
```
#N canvas 436 127 562 502 12;
#X obj 86 51 loadbang;
#X msg 86 76 \; pd dsp 1;
#X obj 253 51 netreceive -u -b 57120;
#X obj 253 76 oscparse;
#X obj 253 101 list trim;
#X obj 253 126 route fader_1 button_1;
#X msg 253 190 4 \$1;
#X obj 253 215 pow;
#X obj 253 240 * 200;
#X obj 253 265 lop~ 3;
#X msg 328 265 \$1 100;
#X obj 328 304 line~;
#X obj 279 356 *~;
#X obj 279 381 *~ 0.1;
#X obj 266 424 dac~;
#X text 38 139 Open Stage Control \; "First Steps" tutorial \; hjh
// if this fails (if you have an issue with audio devices),
// you won't hear anything but the onscreen GUIs
// will reflect changes from Open Stage Control
s.waitForBoot {
x = { |freq = 200, amp = 0.1, gate = 0|
var eg = EnvGen.kr(Env.asr(0.1, 1, 0.1), gate);
(SinOsc.ar(Lag.kr(freq, 0.1)) * amp * eg).dup
}.play;
};
)
```
## Deploying the interface
The whole point of Open Stage Control is to make the interface available on other devices, especially mobile devices.
The interface will not be visible to other clients, however, until you save it to disk: three-dots menu > Session > Save, and give the file a name such as `open-stage-demo` (you don't need to type the `.json` extension).
Now -- remember those status messages in the launcher window? On another device (computer, phone or tablet), go to the `http://192.168.xxx.yyy:8080` address. The device should be on the same (W)LAN. (If there is another remote address, it may or may not work, depending on your network.) Supported browsers are Firefox v. 75 and higher, or Chromium/Chrome v. 60 and higher.
This should open an empty client window, similar to the one you saw before.
From here, you can open the session that you just saved: three-dots menu *in the webpage* > Session > Open Recent (yes, this is synced from the server!). This should display the controls created in that session, and the controls should function the same as in the other client window.
And that is... it! Basic usage is as simple as that.
For convenience, if there is a session you know that you will use often, and you don't want to load it in the webpage by hand every time, you can choose the file under "load" in the initial Launcher window. This is also useful for public deployments with audience participation, where you don't want audience members to have to load manually.
When not using Open Stage Control, you can also stop the server from the launcher window (stop button, top-left).
Client specific options can be set by adding query parameters to the server's url. One must prepend the url with a question mark (`?`) followed by `parameter=value` pairs separated with ampersands (`&`).
Clicking on a widget, on a tab label or on an item in the project tree selects the widgets for editing:
- All its editable properties are shown in the inspector panel
- The corresponding item in the project tree is highlighted
- A selection outline is drawn around the widget
- Dragging / Resizing handles are added to the widget

To interact with a widget directly without selecting it, either use the middle mouse button or hold ++shift+win++ (++shift+cmd++ on Mac).
## Menu
Right clicking on a widget displays a menu with the following actions
- `Show in tree`: show widget in project tree (hidden when clicking in the project tree)
- `Position`:
- `Send to back`: Send selected widget to back (first of siblings)
- `Send farther`: Send selected widget farther
- `Bring closer`: Bring selected widget closer
- `Bring to front`: Bring selected widget to front (last of siblings)
- `Copy`: copy widget's data
- `Cut`: copy widget's data and delete selected widget
- `Paste`: paste copied widget in selected container
- `Paste`: paste the widget as is
- `ID + 1` : increments the id of the copied widget (and all its children) before pasting
- `Clone` : create a clone widget targetting the copied widget
- `Add widget`: create a new widget in selected container
- `Add tab`: create a new tab in selected container
- `Export`: export as fragment file
- `Delete`: delete selected tab or widget
## Inspector
Selected widget's properties are displayed and can be modified in the inspector. The [properties reference](../widgets/properties-reference.md) lists the available properties for each widget type.
- Property fields are all multiline (press `shift + enter` for new line).
- Properties are written in JSON, with some flexibility brought by the [JSON5](https://github.com/json5/json5) format. For example, double quotes around object keys are not mandatory.
- Clicking on a property name spawns a help modal window
- Properties are divided into multiple categories that can be toggled with a click. ++alt+"Click"++ on a category closes the other categories before toggling selected category.
Some properties (for example `onValue`) have a special code editor with syntax highlighting and many keyboard shortcuts (available by clicking on the "Help" button). In these properties, pressing `enter` will not submit pending changes but instead insert a new line at the cursor position (as you would expect in a regular editor). To submit pending changes, press ++ctrl+enter++ (or ++cmd+enter== on Mac) or click outside the editor.
Widgets can be locked for edition by enabling their `lock` property. When locked, a widget can't be modified by the editor but it remains possible to delete it or to move it from a container to another in the project tree.
##Project tree
The project tree displays the whole widget structure of the session. Widgets can be reordered or moved to another container with drag-and-drop.
The "Filter" input allows filtering displayed widgets by their `id`. It's also possible to only display a single type of widget by typing `type:fader` for example.
Invisible widgets are displayed with a lower opacity and their name in italic. Locked widgets are displayed with a lock icon after their name.
## Widget resizing / dragging
Selected widget can be resized using its south, south-east and east handles. It can be dragged with its north-west handle (holding ++alt++ extends this handle to the widget's size to ease dragging). If the widget's position/size was written in percents, the editor will try to keep using percents.
When the grid is enabled, widget resizing / dragging snaps to a 10 pixel wide grid.
## Multi-widgets editing
Multiple widgets can be edited at once.
- The inspector will only display properties that are shared by all selected widgets
- Selection can only contain sibling widgets (same direct parent)
- Context-menu actions and properties changes apply to all selected widgets
- Resizing / Dragging will affect all selected widgets, relatively the selection's size and position
## Keyboard shortcuts
=== "Linux / Windows"
| Shortcut | Description |
|---|---|
| ++ctrl+g++ | Toggle grid. |
| ++ctrl+t++ | Toggle session tree. |
| ++ctrl+i++ | Toggle inspector. |
| ++"Click"++ | Widget selection. |
| ++ctrl+"Click"++ | Multi-widget selection. Widgets can be toggled from selection by clicking on them individually.|
| ++shift+"Click"+"Drag"++ | Draw a selection rectangle and attempt to select widgets in it. If ++ctrl++ is pressed too, current selection is kept and will be merged with the new one if possible. |
| ++ctrl+z++ |Undo |
| ++ctrl+y++ <br/>++ctrl+shift+z++ |Redo |
| ++delete++ |Delete selected widgets |
| ++ctrl+c++ |Copy selected widgets |
| ++ctrl+x++ |Cut selected widgets |
| ++ctrl+v++ |Paste clipboard in selected widget |
| ++ctrl+shift+v++ |Paste and increment id |
| ++ctrl+d++ | Duplicate selected widget |
| ++ctrl+shift+d++ | Duplicate selected widget and increment id |
| ++alt+c+"Drag"++ |Paste selection to position |
| ++alt+c+shift+"Drag"++ |Paste selection to dragged position and increment id |
| ++ctrl+up++ <br/>++ctrl+down++ <br/>++ctrl+left++ <br/>++ctrl+right++ |Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++alt+up++ <br/>++alt+down++ <br/>++alt+left++ <br/>++alt+right++ | Resize selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++ctrl+a++ | Select current widget's siblings and itself |
| ++ctrl+shift+a++ | Cancel current widget selection |
| ++up++ | Select current widget's previous sibling |
| ++down++ | Select current widget's next sibling |
| ++left++ | Select current widget's parent |
| ++right++ | Select current widget's first child |
| ++t++ | Show selected widget(s) in the project tree |
| ++y++ | Show selected widget(s) in the session |
| ++ctrl+f++ | Focus search input in project tree |
| ++"F2"++ | Bring "label" property input into view if selected widget has one |
| ++h++ | Hide selection area and widget resize / drag handles while pressed |
| ++alt+"Mousewheel"++ | change editor zoom |
| ++ctrl+0++ | reset zoom |
=== "Mac"
| Shortcut | Description |
|---|---|
| ++cmd+g++ | Toggle grid. |
| ++cmd+t++ | Toggle session tree. |
| ++cmd+i++ | Toggle inspector. |
| ++"Click"++ | Widget selection. |
| ++cmd+"Click"++ | Multi-widget selection. Widgets can be toggled from selection by clicking on them individually.|
| ++shift+"Click"+"Drag"++ | Draw a selection rectangle and attempt to select widgets in it. If ++cmd++ is pressed too, current selection is kept and will be merged with the new one if possible. |
| ++cmd+z++ |Undo |
| ++cmd+y++ <br/>++cmd+shift+z++ |Redo |
| ++backspace++ |Delete selected widgets |
| ++cmd+c++ |Copy selected widgets |
| ++cmd+x++ |Cut selected widgets |
| ++cmd+v++ |Paste clipboard in selected widget |
| ++cmd+shift+v++ |Paste and increment id |
| ++cmd+d++ | Duplicate selected widget |
| ++cmd+shift+d++ | Duplicate selected widget and increment id |
| ++alt+c+"Drag"++ |Paste selection to position |
| ++alt+c+shift+"Drag"++ |Paste selection to dragged position and increment id |
| ++cmd+up++ <br/>++cmd+down++ <br/>++cmd+left++ <br/>++cmd+right++ |Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++alt+up++ <br/>++alt+down++ <br/>++alt+left++ <br/>++alt+right++ | Resize selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++cmd+a++ | Select current widget's siblings and itself |
| ++cmd+shift+a++ | Cancel current widget selection |
| ++up++ | Select current widget's previous sibling |
| ++down++ | Select current widget's next sibling |
| ++left++ | Select current widget's parent |
| ++right++ | Select current widget's first child |
| ++t++ | Show selected widget in the project tree |
| ++y++ | Show selected widget(s) in the session |
| ++cmd+f++ | Focus search input in project tree |
- New window: open a new client window (hidden when stopped)
- Load: load server configuration from file
- Save / Save as: save server configuration to file
- MIDI
- List devices: list available MIDI devices in the console
- Restart backend: restart midi backend without restarting the server
- Console:
- Clear: clear console
- Autoscroll: enable/disable console autoscroll
- Check for update at startup: enable/disable this feature
- Launcher
- Autostart: start the server automatically when launcher is started
- Always on top: pin the launcher window above other the windows
- Use tray: enable tray icon and menu
- Start minimized: starts the launcher minimized (or hidden in tray)
The "play/stop" icon can be used to start and stop the server without opening the menu.
## 2. Configuration form
Each server option is displayed here. When clicking on an option's label, a short help will be printed in the console. When an option is not correctly set, its label will turn to orange and an error message will be printed in the console.
## 3. Console
The console displays various information, runtime errors and server debug messages.
## Tray icon
If `Use tray` is set, the launcher comes with a system tray icon that keeps the launcher alive when closed if there is at least one client window opened or if the server is running. Its context menu can be used to toggle the launcher's visibility and access some of the launcher's menu actions.
| <h4id="id">id<aclass="headerlink"href="#id"title="Permanent link">#</a></h4> | `string` | <code>"auto"</code> | Widgets sharing the same `id` will act as clones and update each other's value(s) without sending extra osc messages. |
| <h4id="linkId">linkId<aclass="headerlink"href="#linkId"title="Permanent link">#</a></h4> | `string`|<br/>`array` | <code>""</code> | Widgets sharing the same `linkId` update each other's value(s) AND send their respective osc messages.<br/><br/>When prefixed with >>, the `linkId` will make the widget act as a master (sending but not receiving)<br/><br/>When prefixed with <<, the `linkId` will make the widget act as a slave (receiving but not sending) |
| <h4id="left">left<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#left"title="Permanent link">#</a></h4> | `number`|<br/>`string` | <code>"auto"</code> | When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).<br/><br/>Otherwise, the widget will be absolutely positioned |
| <h4id="top">top<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#top"title="Permanent link">#</a></h4> | `number`|<br/>`percentage` | <code>"auto"</code> | When both top and left are set to auto, the widget is positioned according to the normal flow of the page (from left to right, by order of creation).<br/><br/>Otherwise, the widget will be absolutely positioned |
| <h4id="label">label<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#label"title="Permanent link">#</a></h4> | `string`|<br/>`boolean` | <code>"auto"</code> | Set to `false` to hide completely<br/><br/>Insert icons using the prefix ^ followed by the icon's name : ^play, ^pause, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free) |
| <h4id="color">color<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#color"title="Permanent link">#</a></h4> | `string` | <code>"auto"</code> | Defines the widget's accent color (css variable `--custom-color`). Must be a valid CSS color. Set to "auto" to inherit from parent widget. |
| <h4id="default">default<aclass="headerlink"href="#default"title="Permanent link">#</a></h4> | `*` | <code>""</code> | If set, the widget will be initialized with this value when the session is loaded. |
| <h4id="value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#value"title="Permanent link">#</a></h4> | `*` | <code>""</code> | Define the widget's value depending on other widget's values / properties using property inheritance and property maths |
| <h4id="precision">precision<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#precision"title="Permanent link">#</a></h4> | `integer`|<br/>`string` | <code>2</code> | Defines the number of decimals to display and to send.<br/><br/>Set to `0` to send integers only.<br/><br/>Data type can be specified by appending a valid osc type tag to the precision value, for example : `3d` will make the widget send double precision numbers rounded to three decimals |
| <h4id="address">address<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#address"title="Permanent link">#</a></h4> | `string` | <code>"auto"</code> | OSC address for sending messages, it must start with a / |
| <h4id="preArgs">preArgs<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#preArgs"title="Permanent link">#</a></h4> | `*`|<br/>`array` | <code>""</code> | A value or array of values that will be prepended to the OSC messages.<br/><br/>Values can be defined as objects if the osc type tag needs to be specified: `{type: "i", value: 1}` |
| <h4id="target">target<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#target"title="Permanent link">#</a></h4> | `string`|<br/>`array`|<br/>`null` | <code>""</code> | This defines the targets of the widget's OSC messages<br/>- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:port"]`<br/>- If midi is enabled, targets can be `midi:device_name`<br/>- The special item `"self"` can be used to refer to the emitting client directly.<br/>- If no target is set, messages can still be sent if the server has default targets<br/>- The server's default targets can be bypassed by setting one of the items to `null` |
| <h4id="bypass">bypass<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#bypass"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to prevent the widget from sending any osc message |</div>
| <h4id="fader_horizontal">horizontal<aclass="headerlink"href="#fader_horizontal"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display the fader horizontally |
| <h4id="fader_alignRight">alignRight<aclass="headerlink"href="#fader_alignRight"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to invert the pip's and fader's position |
| <h4id="fader_pips">pips<aclass="headerlink"href="#fader_pips"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the scale |
| <h4id="fader_input">input<aclass="headerlink"href="#fader_input"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the built-in input |
| <h4id="fader_meter">meter<aclass="headerlink"href="#fader_meter"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to true to display a vu-meter next in the fader<br/>- the meter's `id` will be the same as the widget's with `/meter` appended to it<br/>- the meter's `address` will be the same as the widget's with `/meter` appended to it |
| <h4id="fader_compact">compact<aclass="headerlink"href="#fader_compact"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display a compact alternative for the widget. If `input` is `true`, the input can be focused with a right-click (mouse only). Disables `pips` when enabled. |
| <h4id="fader_dashed">dashed<aclass="headerlink"href="#fader_dashed"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display a dashed gauge |
| <h4id="fader_snap">snap<aclass="headerlink"href="#fader_snap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | By default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position |
| <h4id="fader_spring">spring<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#fader_spring"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | When set to `true`, the widget will go back to its `default` value when released |
| <h4id="fader_doubleTap">doubleTap<aclass="headerlink"href="#fader_doubleTap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the fader reset to its `default` value when receiving a double tap.<br/><br/>Can also be an osc address, in which case the widget will just send an osc message (`/<doubleTap> <preArgs>`) |
| <h4id="fader_range">range<aclass="headerlink"href="#fader_range"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the breakpoints of the fader's scale:<br/>- keys can be percentages and/or `min` / `max`<br/>- values can be `number` or `object` if a custom label is needed<br/><br/>Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`) |
| <h4id="fader_logScale">logScale<aclass="headerlink"href="#fader_logScale"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="fader_sensitivity">sensitivity<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#fader_sensitivity"title="Permanent link">#</a></h4> | `number` | <code>1</code> | Defines the fader's sensitivity when `snap` is `false` |
| <h4id="fader_steps">steps<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#fader_steps"title="Permanent link">#</a></h4> | `string`|<br/>`number`|<br/>`array` | <code>""</code> | Restricts the widget's value:<br/>- `auto`: use values defined in `range`<br/>- `number`: define a number of evenly spaced steps<br/>- `array`: use arbitrary values |
| <h4id="fader_unit">unit<aclass="headerlink"href="#fader_unit"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Unit will be appended to the displayed widget's value (it doesn't affect osc messages) |
| <h4id="fader_origin">origin<aclass="headerlink"href="#fader_origin"title="Permanent link">#</a></h4> | `number` | <code>"auto"</code> | Defines the starting point's value of the fader's gauge |
| <h4id="fader_touchAddress">touchAddress<aclass="headerlink"href="#fader_touchAddress"title="Permanent link">#</a></h4> | `string` | <code>""</code> | OSC address for touched state messages: `/touchAddress [preArgs] 0/1` |
| <h4id="fader_meterAddress">meterAddress<aclass="headerlink"href="#fader_meterAddress"title="Permanent link">#</a></h4> | `string` | <code>""</code> | OSC address for the built-in meter |</div>
| <h4id="knob_pips">pips<aclass="headerlink"href="#knob_pips"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to show the scale's breakpoints |
| <h4id="knob_input">input<aclass="headerlink"href="#knob_input"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the built-in input |
| <h4id="knob_compact">compact<aclass="headerlink"href="#knob_compact"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display a compact alternative for the widget. If `input` is `true`, the input can be focused with a right-click (mouse only). Disables `pips` when enabled. |
| <h4id="knob_dashed">dashed<aclass="headerlink"href="#knob_dashed"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display a dashed gauge |
| <h4id="knob_angle">angle<aclass="headerlink"href="#knob_angle"title="Permanent link">#</a></h4> | `number` | <code>270</code> | Defines the angle's width of the knob, in degrees |
| <h4id="knob_snap">snap<aclass="headerlink"href="#knob_snap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | By default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position |
| <h4id="knob_spring">spring<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#knob_spring"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | When set to `true`, the widget will go back to its `default` value when released |
| <h4id="knob_doubleTap">doubleTap<aclass="headerlink"href="#knob_doubleTap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the knob reset to its `default` value when receiving a double tap.<br/><br/>Can also be an osc address, in which case the widget will just send an osc message (`/<doubleTap> <preArgs>`) |
| <h4id="knob_range">range<aclass="headerlink"href="#knob_range"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the breakpoints of the fader's scale:<br/>- keys can be percentages and/or `min` / `max`<br/>- values can be `number` or `object` if a custom label is needed<br/><br/>Example: (`{min:{"-inf": 0}, "50%": 0.25, max: {"+inf": 1}}`) |
| <h4id="knob_logScale">logScale<aclass="headerlink"href="#knob_logScale"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="knob_sensitivity">sensitivity<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#knob_sensitivity"title="Permanent link">#</a></h4> | `number` | <code>1</code> | Defines the knob's sensitivity when `snap` is `false` |
| <h4id="knob_steps">steps<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#knob_steps"title="Permanent link">#</a></h4> | `string`|<br/>`number`|<br/>`array` | <code>""</code> | Restricts the widget's value:<br/>- `auto`: use values defined in `range`<br/>- `number`: define a number of evenly spaced steps<br/>- `array`: use arbitrary values |
| <h4id="knob_unit">unit<aclass="headerlink"href="#knob_unit"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Unit will be appended to the displayed widget's value (it doesn't affect osc messages) |
| <h4id="knob_origin">origin<aclass="headerlink"href="#knob_origin"title="Permanent link">#</a></h4> | `number` | <code>"auto"</code> | Defines the starting point's value of the knob's gauge |
| <h4id="encoder_compact">compact<aclass="headerlink"href="#encoder_compact"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display a compact alternative for the widget. |
| <h4id="encoder_ticks">ticks<aclass="headerlink"href="#encoder_ticks"title="Permanent link">#</a></h4> | `number` | <code>360</code> | defines the granularity / verbosity of the encoder (number of step for a 360° arc) |
| <h4id="encoder_back">back<aclass="headerlink"href="#encoder_back"title="Permanent link">#</a></h4> | `*` | <code>-1</code> | Defines which value is sent when rotating the encoder anticlockwise |
| <h4id="encoder_forth">forth<aclass="headerlink"href="#encoder_forth"title="Permanent link">#</a></h4> | `*` | <code>1</code> | Defines which value is sent when rotating the encoder clockwise |
| <h4id="encoder_release">release<aclass="headerlink"href="#encoder_release"title="Permanent link">#</a></h4> | `number` | <code>""</code> | Defines which value is sent when releasing the encoder:<br/>- Set to `null` to send send no argument in the osc message<br/>- Can be an `object` if the type needs to be specified |
| <h4id="encoder_snap">snap<aclass="headerlink"href="#encoder_snap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | By default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position |
| <h4id="encoder_doubleTap">doubleTap<aclass="headerlink"href="#encoder_doubleTap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the fader reset to its `default` value when receiving a double tap.<br/><br/>Can also be an osc address, in which case the widget will just send an osc message (`/<doubleTap> <preArgs>`) |
| <h4id="range_split">split<aclass="headerlink"href="#range_split"title="Permanent link">#</a></h4> | `boolean`|<br/>`object` | <code>false</code> | Set to `true` to send separate osc messages for `low` and `high` handles. The `address` will be the same as the widget's with `/low` or `/high` appended to it<br/><br/>Can be set as an object to specify a different `address` : `['/osc_address_low', '/osc_address_high']`<br/><br/>Note: the widget will only respond to its original osc address, not to the splitted version |</div>
| <h4id="toggle_doubleTap">doubleTap<aclass="headerlink"href="#toggle_doubleTap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the button require a double tap to be toggled instead of a single tap |
| <h4id="toggle_led">led<aclass="headerlink"href="#toggle_led"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display the toggle's state with a led |
| <h4id="toggle_on">on<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#toggle_on"title="Permanent link">#</a></h4> | `*` | <code>1</code> | Set to `null` to send send no argument in the osc message<br/><br/>Can be an `object` if the type needs to be specified (see preArgs) |
| <h4id="toggle_off">off<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#toggle_off"title="Permanent link">#</a></h4> | `*` | <code>0</code> | Set to `null` to send send no argument in the osc message<br/><br/>Can be an `object` if the type needs to be specified (see preArgs) |</div>
| <h4id="push_doubleTap">doubleTap<aclass="headerlink"href="#push_doubleTap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the button require a double tap to be pushed instead of a single tap |
| <h4id="push_on">on<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#push_on"title="Permanent link">#</a></h4> | `*` | <code>1</code> | Set to `null` to send send no argument in the osc message<br/><br/>Can be an `object` if the type needs to be specified (see preArgs) |
| <h4id="push_off">off<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#push_off"title="Permanent link">#</a></h4> | `*` | <code>0</code> | Set to `null` to send send no argument in the osc message<br/><br/>Can be an `object` if the type needs to be specified (see preArgs) |
| <h4id="push_norelease">norelease<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#push_norelease"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to prevent sending any osc message when releasing the button |</div>
| <h4id="switch_horizontal">horizontal<aclass="headerlink"href="#switch_horizontal"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display values horizontally |
| <h4id="switch_showValues">showValues<aclass="headerlink"href="#switch_showValues"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | If values is an object, set to `true` to display both values and labels instead of labels only |
| <h4id="switch_values">values<aclass="headerlink"href="#switch_values"title="Permanent link">#</a></h4> | `array`|<br/>`object` | <code>\{<br/> "Value 1": 1,<br/> "Value 2": 2<br/>}</code> | `Array` of possible values to switch between : `[1,2,3]`<br/><br/>`Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept |
| <h4id="switch_traversing">traversing<aclass="headerlink"href="#switch_traversing"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable traversing gestures |</div>
| <h4id="dropdown_values">values<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#dropdown_values"title="Permanent link">#</a></h4> | `array`|<br/>`object` | <code>\{<br/> "Value 1": 1,<br/> "Value 2": 2<br/>}</code> | `Array` of possible values to switch between : `[1,2,3]`<br/><br/>`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept<br/><br/>An empty option will always be prepended to values (sends an osc message without any value); it can be hidden by adding `option:first-child{display:none}` to the widget's `css` |</div>
| <h4id="menu_size">size<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#menu_size"title="Permanent link">#</a></h4> | `number`|<br/>`array` | <code>200</code> | - If `circular` is `true`: diameter (in px)<br/>- If `circular` is `false`: square size or `[width, height]` array |
| <h4id="menu_circular">circular<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#menu_circular"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Defines whether the menu should be rendered in a circle or in a box |
| <h4id="menu_vertical">vertical<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#menu_vertical"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | If `circular` is `false`, set this to `true` for vertical layout<br/><br/>Ignored when `grid` is `true` |
| <h4id="menu_grid">grid<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#menu_grid"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | - If `circular` is `false`, set this to `true` for grid layout<br/>- Can be a `number` to define the number of columns |
| <h4id="menu_toggle">toggle<aclass="headerlink"href="#menu_toggle"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the menu stay opened after mouse/touch release |
| <h4id="menu_doubleTap">doubleTap<aclass="headerlink"href="#menu_doubleTap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the menu require a double tap to be opened instead of a single tap |
| <h4id="menu_values">values<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#menu_values"title="Permanent link">#</a></h4> | `array`|<br/>`object` | <code>\{<br/> "Value 1": 1,<br/> "Value 2": 2<br/>}</code> | `Array` of possible values to switch between : `[1,2,3]`<br/><br/>`Object` of label:value pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept |
| <h4id="menu_weights">weights<aclass="headerlink"href="#menu_weights"title="Permanent link">#</a></h4> | `array` | <code>""</code> | `Array` of `number` defining the weights of each value in `values`<br/><br/>Ignored when `grid` is `true` |</div>
| <h4id="xy_snap">snap<aclass="headerlink"href="#xy_snap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | By default, the points are dragged from their initial position.<br/><br/>If set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates |
| <h4id="xy_spring">spring<aclass="headerlink"href="#xy_spring"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | When set to `true`, the widget will go back to its default value when released |
| <h4id="xy_pips">pips<aclass="headerlink"href="#xy_pips"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the scale |
| <h4id="xy_rangeX">rangeX<aclass="headerlink"href="#xy_rangeX"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the x axis |
| <h4id="xy_rangeY">rangeY<aclass="headerlink"href="#xy_rangeY"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the y axis |
| <h4id="xy_logScaleX">logScaleX<aclass="headerlink"href="#xy_logScaleX"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="xy_logScaleY">logScaleY<aclass="headerlink"href="#xy_logScaleY"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="xy_input">input<aclass="headerlink"href="#xy_input"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to false to hide the built-in input widget |
| <h4id="xy_doubleTap">doubleTap<aclass="headerlink"href="#xy_doubleTap"title="Permanent link">#</a></h4> | `boolean`|<br/>`string` | <code>false</code> | Set to `true` to make the fader reset to its default value when receiving a double tap.<br/><br/>Can also be an osc address, which case the widget will just send an osc message: `/<doubleTap> <preArgs>` |
| <h4id="xy_sensitivity">sensitivity<aclass="headerlink"href="#xy_sensitivity"title="Permanent link">#</a></h4> | `number` | <code>1</code> | Defines the pad's sensitivity when `snap` is `false` |
| <h4id="xy_touchAddress">touchAddress<aclass="headerlink"href="#xy_touchAddress"title="Permanent link">#</a></h4> | `string` | <code>""</code> | OSC address for touched state messages: `/touchAddress [preArgs] 0/1`) |
| <h4id="xy_split">split<aclass="headerlink"href="#xy_split"title="Permanent link">#</a></h4> | `boolean`|<br/>`object` | <code>false</code> | Set to `true` to send separate osc messages for each point's x and y axis. The address will be the same as the widget's with `/x` or `/y` appended to it<br/><br/>Can be set as an `object` to specify a different address : ['/osc_address_x', '/osc_address_y']<br/><br/>Note: the widget will only respond to its original osc address, not to the splitted version |</div>
| <h4id="rgb_snap">snap<aclass="headerlink"href="#rgb_snap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | By default, the points are dragged from their initial position.<br/><br/>If set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates |
| <h4id="rgb_spring">spring<aclass="headerlink"href="#rgb_spring"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | When set to `true`, the widget will go back to its default value when released |
| <h4id="rgb_input">input<aclass="headerlink"href="#rgb_input"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the built-in input widget |
| <h4id="rgb_alpha">alpha<aclass="headerlink"href="#rgb_alpha"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to enable alpha channel |
| <h4id="rgb_split">split<aclass="headerlink"href="#rgb_split"title="Permanent link">#</a></h4> | `boolean`|<br/>`object` | <code>false</code> | Set to `true` to send separate osc messages for for r and g & b. The address will be the same as the widget's with `/r`, `/g` or `/b` appended to it<br/><br/>Can be set as an `object` to specify a different address : `['/r', '/g', 'b']`<br/><br/>Note: the widget will only respond to its original osc address, not to the splitted version |</div>
| <h4id="multixy_css">css<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#multixy_css"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Available CSS variables:<br/>- `--background: background;`: sets the dragging area's background<br/>- `--pips-color: color;`<br/>- `--pips-opacity: number;`<br/>- `--color-text: point-color;`<br/><br/>Pads can be targetted individually with the .pad-X selector (where X is the pad's index) |
| <h4id="multixy_points">points<aclass="headerlink"href="#multixy_points"title="Permanent link">#</a></h4> | `integer`|<br/>`array` | <code>2</code> | Defines the number of points on the pad<br/><br/>Can be an array of strings that will be used as labels for the points (ex: `['A', 'B']`) |
| <h4id="multixy_snap">snap<aclass="headerlink"href="#multixy_snap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | By default, the points are dragged from their initial position.<br/><br/>If set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates |
| <h4id="multixy_spring">spring<aclass="headerlink"href="#multixy_spring"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | When set to `true`, the widget will go back to its default value when released |
| <h4id="multixy_pips">pips<aclass="headerlink"href="#multixy_pips"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the scale |
| <h4id="multixy_rangeX">rangeX<aclass="headerlink"href="#multixy_rangeX"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the x axis |
| <h4id="multixy_rangeY">rangeY<aclass="headerlink"href="#multixy_rangeY"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the y axis |
| <h4id="multixy_logScaleX">logScaleX<aclass="headerlink"href="#multixy_logScaleX"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="multixy_logScaleY">logScaleY<aclass="headerlink"href="#multixy_logScaleY"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="multixy_sensitivity">sensitivity<aclass="headerlink"href="#multixy_sensitivity"title="Permanent link">#</a></h4> | `number` | <code>1</code> | Defines the pad's sensitivity when `snap` is `false` |
| <h4id="multixy_touchAddress">touchAddress<aclass="headerlink"href="#multixy_touchAddress"title="Permanent link">#</a></h4> | `string` | <code>""</code> | OSC address for touched state messages: `/touchAddress [preArgs] 0/1` |
| <h4id="multixy_split">split<aclass="headerlink"href="#multixy_split"title="Permanent link">#</a></h4> | `boolean`|<br/>`object` | <code>false</code> | Set to `true` to send separate osc messages for each point's x and y axis. The address will be the same as the widget's with `/N/x` or `/N/y` appended to it, where N is the point's id (or the point's label if points is an array)<br/><br/>Can be set as an `object` to specify a different address : `['/0/x', '/0/y', '/1/x', '/2/y']`<br/><br/>Note: the widget will only respond to its original osc address, not to the splitted version |</div>
| <h4id="matrix_widgetType">widgetType<aclass="headerlink"href="#matrix_widgetType"title="Permanent link">#</a></h4> | `string` | <code>"toggle"</code> | Defines the type of the widgets in the matrix |
| <h4id="matrix_matrix">matrix<aclass="headerlink"href="#matrix_matrix"title="Permanent link">#</a></h4> | `array` | <code>[<br/> 2,<br/> 2<br/>]</code> | Defines the number of columns and and rows in the matrix |
| <h4id="matrix_start">start<aclass="headerlink"href="#matrix_start"title="Permanent link">#</a></h4> | `integer` | <code>0</code> | First widget's index |
| <h4id="matrix_spacing">spacing<aclass="headerlink"href="#matrix_spacing"title="Permanent link">#</a></h4> | `integer` | <code>0</code> | Adds space between widgets |
| <h4id="matrix_traversing">traversing<aclass="headerlink"href="#matrix_traversing"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable traversing gestures |
| <h4id="matrix_border">border<aclass="headerlink"href="#matrix_border"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disables the widgets' borders |
| <h4id="matrix_props">props<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#matrix_props"title="Permanent link">#</a></h4> | `object` | <code>\{}</code> | Defines a set of property to override the widgets' defaults.<br/><br/>Formulas in this field are resolved with an extra variable representing each widget's index: `$`<br/><br/>Note: by default, the widgets inherit from the matrix' `id` and osc properties (`id` and `address` are appended with `/$`) |</div>
| <h4id="keyboard_keys">keys<aclass="headerlink"href="#keyboard_keys"title="Permanent link">#</a></h4> | `number` | <code>25</code> | Defines the number keys |
| <h4id="keyboard_start">start<aclass="headerlink"href="#keyboard_start"title="Permanent link">#</a></h4> | `number` | <code>48</code> | MIDI note number to start with (default is C4)<br/><br/>Standard keyboards settings are: `[25, 48]`, `[49, 36]`, `[61, 36]`, `[88, 21]` |
| <h4id="keyboard_traversing">traversing<aclass="headerlink"href="#keyboard_traversing"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable traversing gestures |
| <h4id="keyboard_on">on<aclass="headerlink"href="#keyboard_on"title="Permanent link">#</a></h4> | `*` | <code>1</code> | Set to `null` to send send no argument in the osc message<br/><br/>Can be an `object` if the type needs to be specified (see preArgs) |
| <h4id="keyboard_off">off<aclass="headerlink"href="#keyboard_off"title="Permanent link">#</a></h4> | `*` | <code>0</code> | Set to `null` to send send no argument in the osc message<br/><br/>Can be an `object` if the type needs to be specified (see preArgs) |
| <h4id="keyboard_toggles">toggles<aclass="headerlink"href="#keyboard_toggles"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make keys bahave like toggle buttons |
| <h4id="keyboard_split">split<aclass="headerlink"href="#keyboard_split"title="Permanent link">#</a></h4> | `boolean`|<br/>`string` | <code>false</code> | `true`: the widget's index will be appended to the matrice's osc address<br/><br/>`false`: it will be prepended to the widget's preArgs<br/><br/>`string`: will be used to define the widgets' addresses, replacing dollar signs (`$`) with their respective index (to insert the actual dollar sign, it must be escaped with a backslash (`\$`)) |</div>
| <h4id="patchbay_css">css<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#patchbay_css"title="Permanent link">#</a></h4> | `string` | <code>""</code> | The inputs/ouputs width can be adjusted by using the `.nodes` selector:<br/><br/>`.nodes { width: 25% }` |
| <h4id="patchbay_inputs">inputs<aclass="headerlink"href="#patchbay_inputs"title="Permanent link">#</a></h4> | `array`|<br/>`object` | <code>[<br/> "input_1",<br/> "input_2"<br/>]</code> | - `Array` of input names : `['input_1', 'input_2']`<br/>- `Object` of `"label_1": "input_1"` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept<br/><br/><br/><br/>Patchbay inputs can be connected to one or more outputs and will send messages of the following form when they are connected/disconnected: <br/><br/>`/patchbay_address input_x output_x output_y etc`<br/><br/>If no output is connected to the input, the message will be `/patchbay_address input_x`<br/><br/>The inputs values can be consumed with the property inheritance syntax: `@{patchbay_id/input_1}` returns an array of output names connected to `input_1` |
| <h4id="patchbay_outputs">outputs<aclass="headerlink"href="#patchbay_outputs"title="Permanent link">#</a></h4> | `array`|<br/>`object` | <code>[<br/> "output_1",<br/> "output_2"<br/>]</code> | List of output values the inputs can connect to (see `inputs`). |</div>
| <h4id="plot_rangeX">rangeX<aclass="headerlink"href="#plot_rangeX"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the x axis |
| <h4id="plot_rangeY">rangeY<aclass="headerlink"href="#plot_rangeY"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the y axis |
| <h4id="plot_logScaleX">logScaleX<aclass="headerlink"href="#plot_logScaleX"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="plot_logScaleY">logScaleY<aclass="headerlink"href="#plot_logScaleY"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="plot_origin">origin<aclass="headerlink"href="#plot_origin"title="Permanent link">#</a></h4> | `number` | <code>"auto"</code> | Defines the y axis origin. Set to `false` to disable it. |
| <h4id="plot_bars">bars<aclass="headerlink"href="#plot_bars"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing) |
| <h4id="plot_smooth">smooth<aclass="headerlink"href="#plot_smooth"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`) |
| <h4id="plot_pips">pips<aclass="headerlink"href="#plot_pips"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the scale |
| <h4id="eq_pips">pips<aclass="headerlink"href="#eq_pips"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to false to hide the scale |
| <h4id="eq_resolution">resolution<aclass="headerlink"href="#eq_resolution"title="Permanent link">#</a></h4> | `number` | <code>128</code> | Defines the number of points used to compute the frequency response |
| <h4id="eq_rangeY">rangeY<aclass="headerlink"href="#eq_rangeY"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the y axis |
| <h4id="eq_origin">origin<aclass="headerlink"href="#eq_origin"title="Permanent link">#</a></h4> | `number`|<br/>`boolean` | <code>"auto"</code> | Defines the y axis origin. Set to `false` to disable it |
| <h4id="eq_logScaleX">logScaleX<aclass="headerlink"href="#eq_logScaleX"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="eq_smooth">smooth<aclass="headerlink"href="#eq_smooth"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`) |
| <h4id="eq_value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#eq_value"title="Permanent link">#</a></h4> | `array` | <code>""</code> | Each item must be an object with the following properties<br/>- `type`: string ("highpass", "highshelf", "lowpass", "lowshelf", "peak" or "notch")<br/>- `freq`: number (filter's resonant frequency)<br/>- `q`: number (Q factor)<br/>- `gain`: number<br/>- `on`: boolean |</div>
| <h4id="visualizer_range">range<aclass="headerlink"href="#visualizer_range"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Defines the min and max values for the y axis |
| <h4id="visualizer_origin">origin<aclass="headerlink"href="#visualizer_origin"title="Permanent link">#</a></h4> | `number` | <code>"auto"</code> | Defines the y axis origin. Set to `false` to disable it |
| <h4id="visualizer_logScale">logScale<aclass="headerlink"href="#visualizer_logScale"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm's base. |
| <h4id="visualizer_smooth">smooth<aclass="headerlink"href="#visualizer_smooth"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to make the line smooth. Float values are also acceptable (works fine between `0` and `0.5`) |
| <h4id="visualizer_pips">pips<aclass="headerlink"href="#visualizer_pips"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to hide the scale |</div>
| <h4id="led_range">range<aclass="headerlink"href="#led_range"title="Permanent link">#</a></h4> | `object` | <code>\{<br/> "min": 0,<br/> "max": 1<br/>}</code> | Value to led intensity mapping range |
| <h4id="led_logScale">logScale<aclass="headerlink"href="#led_logScale"title="Permanent link">#</a></h4> | `boolean`|<br/>`number` | <code>false</code> | Set to `true` to use logarithmic scale (base 10). Set to a `number` to define the logarithm's base. |</div>
| <h4id="meter_gradient">gradient<aclass="headerlink"href="#meter_gradient"title="Permanent link">#</a></h4> | `array`|<br/>`object` | <code>[]</code> | When set, the meter's gauge will be filled with a linear color gradient<br/>- each item must be a CSS color string.<br/>- as an `object`: each key must be a number between 0 and 1<br/>- each item must be a CSS color string.<br/><br/>Examples: `['blue', 'red']`, {'0': 'blue', '0.9': 'blue', '1': 'red'} |</div>
| <h4id="text_vertical">vertical<aclass="headerlink"href="#text_vertical"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display the text vertically |
| <h4id="text_wrap">wrap<aclass="headerlink"href="#text_wrap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to wrap long lines automatically.<br/><br/>This will not break overflowing words by default, word-breaking can be enabled by adding `word-break: break-all;` to the `css` property |
| <h4id="text_align">align<aclass="headerlink"href="#text_align"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Set to `left` or `right` to change text alignment (otherwise center) |</div>
| <h4id="image_border">border<aclass="headerlink"href="#image_border"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable the borders and background-color |
| <h4id="image_cache">cache<aclass="headerlink"href="#image_cache"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to false to disable image caching (forces file reload when updating or editing the widget).<br/><br/>When true, sending `reload` to the widget reloads its image without changing its value |
| <h4id="svg_svg">svg<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#svg_svg"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Svg xml definition:<br/>- will be wrapped in a `< svg />` element<br/>- `<path>` commands support a special percent notation (`%x` and `%y`) |
| <h4id="svg_border">border<aclass="headerlink"href="#svg_border"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable the borders and background-color |</div>
| <h4id="html_html">html<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#html_html"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Allowed HTML tags:<br/><br/> h1-6, blockquote, p, a, ul, ol, nl, li,<br/><br/> b, i, strong, em, strike, code, hr, br, div,<br/><br/> table, thead, img, caption, tbody, tr, th, td, pre |
| <h4id="html_border">border<aclass="headerlink"href="#html_border"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable the borders and background-color |</div>
| <h4id="frame_label">label<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#frame_label"title="Permanent link">#</a></h4> | `string`|<br/>`boolean` | <code>"auto"</code> | Set to `false` to hide completely<br/><br/>Insert icons using the prefix ^ followed by the icon's name : ^play, ^pause, etc<br/><br/>If set to `false`, all pointer-events will be disabled on the frame as long as the editor is enabled to ensure it can be selected |
| <h4id="frame_border">border<aclass="headerlink"href="#frame_border"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable the borders and background-color |
| <h4id="frame_value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#frame_value"title="Permanent link">#</a></h4> | `string` | <code>""</code> | External web page URL. Only local URLs are allowed (starting with `http://127.0.0.1/`, `http://10.x.x.x/`, `http://192.168.x.x/`, etc) |</div>
| <h4id="panel_scroll">scroll<aclass="headerlink"href="#panel_scroll"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable scrollbars |
| <h4id="panel_border">border<aclass="headerlink"href="#panel_border"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too |
| <h4id="panel_value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#panel_value"title="Permanent link">#</a></h4> | `integer` | <code>""</code> | Defines currently opened tab in the widget<br/><br/>A tab can be opened only by setting its parent's value |
| <h4id="panel_variables">variables<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#panel_variables"title="Permanent link">#</a></h4> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h4id="panel_widgets">widgets<aclass="headerlink"href="#panel_widgets"title="Permanent link">#</a></h4> | `array` | <code>[]</code> | Each element of the array must be a widget object. A panel cannot contain widgets and tabs simultaneously. |
| <h4id="panel_tabs">tabs<aclass="headerlink"href="#panel_tabs"title="Permanent link">#</a></h4> | `array` | <code>[]</code> | Each element of the array must be a tab object. A panel cannot contain widgets and tabs simultaneously |</div>
| <h4id="strip_scroll">scroll<aclass="headerlink"href="#strip_scroll"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable scrollbars |
| <h4id="strip_horizontal">horizontal<aclass="headerlink"href="#strip_horizontal"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display widgets horizontally |
| <h4id="strip_stretch">stretch<aclass="headerlink"href="#strip_stretch"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to stretch widgets evenly |
| <h4id="strip_border">border<aclass="headerlink"href="#strip_border"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | By default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too |
| <h4id="strip_spacing">spacing<aclass="headerlink"href="#strip_spacing"title="Permanent link">#</a></h4> | `integer`|<br/>`percentage` | <code>0</code> | Adds space between widgets. Percents are always relative to the strips width |
| <h4id="strip_variables">variables<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#strip_variables"title="Permanent link">#</a></h4> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h4id="strip_widgets">widgets<aclass="headerlink"href="#strip_widgets"title="Permanent link">#</a></h4> | `array` | <code>[]</code> | Each element of the array must be a widget object<br/>- By default, children widgets that don't have an explicit `width`/`height` set will be shrinked to respect the sizes specified by others<br/>- Adding `flex:1;` to a children's `css` will give it the ability the fill the remaining space<br/>- Multiple children can have a `flex:x;` css property (`x` will ponderate their expansion) |</div>
| <h4id="modal_doubleTap">doubleTap<aclass="headerlink"href="#modal_doubleTap"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the modal require a double tap to open instead of a single tap |
| <h4id="modal_popupLabel">popupLabel<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#modal_popupLabel"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Alternative label for the modal popup |
| <h4id="modal_scroll">scroll<aclass="headerlink"href="#modal_scroll"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to disable scrollbars |
| <h4id="modal_value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#modal_value"title="Permanent link">#</a></h4> | `integer` | <code>""</code> | Defines the modal's state:`0` for closed, `1` for opened |
| <h4id="modal_variables">variables<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#modal_variables"title="Permanent link">#</a></h4> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h4id="modal_widgets">widgets<aclass="headerlink"href="#modal_widgets"title="Permanent link">#</a></h4> | `array` | <code>[]</code> | Each element of the array must be a widget object |</div>
| <h4id="clone_widgetId">widgetId<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#clone_widgetId"title="Permanent link">#</a></h4> | `string` | <code>""</code> | `id` of the widget to clone |
| <h4id="root_id">id<aclass="headerlink"href="#root_id"title="Permanent link">#</a></h4> | `string` | <code>"root"</code> | Widgets sharing the same id will act as clones and update each other's value(s) without sending extra osc messages |
| <h4id="root_value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#root_value"title="Permanent link">#</a></h4> | `integer` | <code>""</code> | Defines currently opened tab in the widget<br/><br/>A tab can be opened only by setting its parent's value |
| <h4id="root_traversing">traversing<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#root_traversing"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget |
| <h4id="root_variables">variables<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#root_variables"title="Permanent link">#</a></h4> | `*` | <code>\{}</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h4id="root_tabs">tabs<aclass="headerlink"href="#root_tabs"title="Permanent link">#</a></h4> | `array` | <code>[<br/> \{}<br/>]</code> | Each element of the array must be a tab object |</div>
| <h4id="tab_detached">detached<aclass="headerlink"href="#tab_detached"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` if the tab contains `frame` widgets that should not be reloaded when the tab opens |
| <h4id="tab_value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#tab_value"title="Permanent link">#</a></h4> | `integer` | <code>""</code> | Defines currently opened tab in the widget<br/><br/>A tab can be opened only by setting its parent's value |
| <h4id="tab_variables">variables<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#tab_variables"title="Permanent link">#</a></h4> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h4id="tab_widgets">widgets<aclass="headerlink"href="#tab_widgets"title="Permanent link">#</a></h4> | `array` | <code>[]</code> | Each element of the array must be a widget object. A tab cannot contain widgets and tabs simultaneously |
| <h4id="tab_tabs">tabs<aclass="headerlink"href="#tab_tabs"title="Permanent link">#</a></h4> | `array` | <code>[]</code> | Each element of the array must be a tab object. A tab cannot contain widgets and tabs simultaneously |</div>
| <h4id="state_filter">filter<aclass="headerlink"href="#state_filter"title="Permanent link">#</a></h4> | `string`|<br/>`array` | <code>""</code> | Only save state from widgets contained in widgets designated by id. If empty, the whole session's state is saved. Switchers are always ignored.<br/>- widget id `string`<br/>- `array` of widget id strings |
| <h4id="state_saveLabel">saveLabel<aclass="headerlink"href="#state_saveLabel"title="Permanent link">#</a></h4> | `string` | <code>"Save"</code> | Label for save button |
| <h4id="state_value">value<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#state_value"title="Permanent link">#</a></h4> | `object`|<br/>`string` | <code>""</code> | - `object`: `"widget_id": VALUE` pairs<br/>- `string`: `"save"` (trigger save action), `"load"` (trigger load action) or `""` (reset value)<br/><br/><br/><br/>Note: the widget's actual value is never `"save"` or `"load"`, it's either an empty string or an object. |</div>
| <h4id="switcher_linkedWidgets">linkedWidgets<aclass="headerlink"href="#switcher_linkedWidgets"title="Permanent link">#</a></h4> | `string`|<br/>`array` | <code>""</code> | - `String`: a widget's `id` whose state changes will be stored<br/>- `Array`: a list of widget `id` string |
| <h4id="switcher_horizontal">horizontal<aclass="headerlink"href="#switcher_horizontal"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display values horizontally |
| <h4id="switcher_values">values<aclass="headerlink"href="#switcher_values"title="Permanent link">#</a></h4> | `array`|<br/>`object` | <code>\{<br/> "Value 1": 1,<br/> "Value 2": 2<br/>}</code> | Each item represents a bank that stores the values from the widgets listed in `linkedWidgets`<br/>- `Array` of possible values to switch between : `[1,2,3]`<br/>- `Object` of `"label":value` pairs. Numeric labels must be prepended or appended with a white space (or any other non-numeric character) otherwise the order of the values won't be kept |</div>
| <h4id="crossfader_linkedWidgets">linkedWidgets<aclass="headerlink"href="#crossfader_linkedWidgets"title="Permanent link">#</a></h4> | `string`|<br/>`array` | <code>""</code> | - `String`: a widget's `id` whose state changes will be stored<br/>- `Array`: a list of widget `id` string |
| <h4id="crossfader_horizontal">horizontal<aclass="headerlink"href="#crossfader_horizontal"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display values horizontally |</div>
| <h4id="input_vertical">vertical<aclass="headerlink"href="#input_vertical"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to display the text vertically |
| <h4id="input_align">align<aclass="headerlink"href="#input_align"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Set to `left` or `right` to change text alignment (otherwise center) |
| <h4id="input_unit">unit<aclass="headerlink"href="#input_unit"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Unit will be appended to the displayed widget's value (it doesn't affect osc messages) |
| <h4id="input_editable">editable<aclass="headerlink"href="#input_editable"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to make the input non-editable |
| <h4id="input_asYouType">asYouType<aclass="headerlink"href="#input_asYouType"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to make the input send its value at each keystroke |</div>
| <h4id="keys_binding">binding<aclass="headerlink"href="#keys_binding"title="Permanent link">#</a></h4> | `string`|<br/>`array` | <code>""</code> | Key combo `string` or `array` of strings (see <ahref="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation) |
| <h4id="keys_keydown">keydown<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#keys_keydown"title="Permanent link">#</a></h4> | `string` | <code>""</code> | This property is evaluated each time the key combo is pressed and defines the widget's own value. Formulas are given extras variables in this context:<br/>- `key`: pressed key name (usefull for handling multiple keys with a single keys widget, lowercased when referencing a character key)<br/>- `code`: pressed key code name (<ahref="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code#Code_values">full list</a>)<br/>- `ctrl`: control key state<br/>- `alt`: alt key state<br/>- `shift`: shift key state<br/>- `meta`: command/windows key state |
| <h4id="keys_keyup">keyup<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#keys_keyup"title="Permanent link">#</a></h4> | `string` | <code>""</code> | Same as `keydown`, but evaluated when releasing the key combo |
| <h4id="keys_repeat">repeat<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#keys_repeat"title="Permanent link">#</a></h4> | `boolean` | <code>true</code> | Set to `false` to prevent keydown repeats when holding the key combo pressed |</div>
| <h4id="script_condition">condition<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#script_condition"title="Permanent link">#</a></h4> | `string` | <code>1</code> | When the widget receives a value, if this property return a falsy value, the script property won't be evaluated. If it's non-falsy, it will be evaluated normally. Formulas are given one extra variable in this context:<br/>- `value`: the value received by the widget |
| <h4id="script_script">script<iclass="dynamic-prop-icon"title="dynamic"></i><aclass="headerlink"href="#script_script"title="Permanent link">#</a></h4> | `string` | <code>""</code> | This property is evaluated each time the widget receives a value* if condition is non-falsy. Formulas are given extras variables in this context:<br/>- `value`: value received by the widget<br/>- `id`: id of the widget that triggered the script<br/>- `send(target, address, arg1, arg2, ...)`: function for sending osc messages (ignores the script's targets and the server's defaults unless `target` is `false`; ignores the script's `preArgs`)<br/>- `set(id, value)`: function for setting a widget's value<br/>- `get(id)`: function for getting a widget's value (dynamic equivalent of @{id})<br/>- `getProp(id, property)`: function for getting a widget's property value ((dynamic equivalent of @{id.property})<br/>- `httpGet(url, callback)`: function for making http requests (asynchronous "GET" request and local urls only)<br/><br/><br/><br/>* Note: `value` or `linkId` properties can be used to receive other widgets' values. The `value` property must actually change to trigger the execution, where linked widgets via `linkId` can submit the same value over and over and trigger the execution |</div>
| <h4id="gyroscope_frequency">frequency<aclass="headerlink"href="#gyroscope_frequency"title="Permanent link">#</a></h4> | `number` | <code>30</code> | Value update frequency (updates per seconds) |
| <h4id="gyroscope_compass">compass<aclass="headerlink"href="#gyroscope_compass"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to return the orientation values with respect to the actual north direction of the world instead of the head direction of the device |
| <h4id="gyroscope_screenAdjusted">screenAdjusted<aclass="headerlink"href="#gyroscope_screenAdjusted"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to return screen adjusted values |
| <h4id="file_extension">extension<aclass="headerlink"href="#file_extension"title="Permanent link">#</a></h4> | `string` | <code>"*"</code> | Only display files with this extension |
| <h4id="file_hidePath">hidePath<aclass="headerlink"href="#file_hidePath"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Set to `true` to only display the filename (the whole path will still be used as value) |
| <h4id="file_allowDir">allowDir<aclass="headerlink"href="#file_allowDir"title="Permanent link">#</a></h4> | `boolean` | <code>false</code> | Allow selecting a folder (by pressing "open" when no file is selected) |</div>
Advanced syntaxes are special blocks of code that can be written in the widgets properties to customize the widgets and how they behave. These blocks end up replaced with the value they hold before the widgets evaluate the properties they're in.
## Inheritance: `@{id.property}`
The inheritance syntax returns either a widget's value or one of its properties. When using this syntax, value or property changes will be applied automatically.
- `id`: target widget's `id`. A widget can fetch its own properties or its direct parent's by using the keywords `this` or `parent` instead of `id`. When `this` or `parent` can be used, using the target widget's `id` instead won't work.
- `property`: target widget's property name. If omitted (along with the dot), the widget's value will be returned (`@{widgetId}` is the same as `@{widgetId.value}`). `value` always resolves to the target widget's current value, not its `value` property.
!!! note "Unique identifier"
Each widget has a unique random identifier that can be retrieved with the property name `uuid` (e.g. `@{this.uuid}`, `@{parent.uuid}`).
####Dynamic properties
Some properties, when changed, trigger a complete widget recreation that ends any ongoing user interaction. Also, updating these properties continuously (e.g. when linked to a slider's dynamic value) can be very cpu expensive.
Some properties have much cheaper update routines and can be considered as `dynamic`, as in performance safe. These properties are marked in the documentation with a <iclass="fas fa-bolt"title="dynamic"></i>.
#### Circular references cases
- container widgets can inherit their children's properties only to define `dynamic` properties
- widgets can inherit their own `value`<iclass="dynamic-prop-icon"title="dynamic"></i> property only to define `dynamic` properties
#### Object properties
If the retrieved property is an object (`{}`), a subset can be retrieved directly by appending a dot and a key (array index or object key) : `@{parent.variables.key}`
#### Nesting
The inheritance syntax supports 1-level nesting for defining the target widget's id dynamically : `@{fader_@{toggle_1}}`
The OSC listener syntax returns the value received on specified address (or the `default` value if none has been received yet).
- `address`: osc address to listen to; if the leading slash (`/`) is omitted, the address will be prefixed with the widget's `address` property
- `default` (optional): default value returned before any message is received. Must be a primitive value, not an object or an array.
- `usePreArgs` (optional): by default, osc listeners inherit the widget's `preArgs` (these must be matched for the osc messages to be processed). Set to `false` bypass them.
Options can contain `@{}` blocks.
!!! note "Receiving MIDI"
Midi messages will be processed only if the receiver's widget includes the emitting MIDI device in its targets.
??? example "Array/Object default value"
```js
JS{
return OSC{address} || {
"key a": 1,
"key b": 2
}
}
```
## Custom variables: `VAR{variableName, default}`
This syntax creates a custom variable in the widget that can be read and modified from any widget's script property (see [scripting](./scripting.md#getvarid-name)). Changes made to this variable using `setVar()` in scripts will be applied automatically where `VAR{}` is used.`
## File imports: `IMPORT{file_name}`
This allows loading the content of an external file in a property. If used in a `JS{}` of `#{}` block, it will be seen as a string variable containing the raw content of the file. Changes made to the file be applied automatically.
File paths are resolved in this order:
- in the session's directory
- in theme's directory
- in the server's `remote-root` directory if the option is set
- as absolute paths
!!! warning
[Fragments](../fragments/) and session files already loaded with fragment widgets should not be imported using this syntax.
## Javascript: `JS{ <code> }`
This syntax allows defining a property using [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript). The code will be compiled as a function and executed in a restricted context.
- if no `return` statement is found, the formula will return an empty string
- javascript [strict mode](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Strict_mode) is always enabled
- `setTimeout` and `setInterval` functions are not available
A property *cannot* contain multiple `JS{}` blocks
#### Available variables
- `console`: javascript console
- `locals`: object for storing/reading arbitrary values. Changing its properties *does not* trigger any synchronisation even if the value is used somewhere else.
- `globals`: same as `locals` but shared between all widgets, contains a few useful variables:
- `platform`: operating system as seen by the client
- `session`: session file path
- `clipboard`: instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard)
Parsing errors can be read in the console (++ctrl+k++).
!!! warning
Modifying values in `locals` or `globals`**does not** trigger anything if they are used somewhere else.
#### Using in advanced syntaxes
In this context, `@{}`, `VAR{}` and `OSC{}` syntaxes are seen as variables. When they change, the whole block will be evaluated again.
!!! danger "Do not mutate"
When these syntaxes return objects or arrays, mutating said objects will affect the underlying variables in memory and may lead to unexpected behavior.
The `@{}` syntax, when used for anything else than the widget's value, will always return a copy of the property and is not affected by this.
## Javascript: `#{ <code> }`
This is a shorthand for the `JS{}` syntax, the only difference being that `<code>` is automatically prepended with a `return` statement.
The canvas widget allows creating custom widgets with user-defined drawings and touch reactions.
It has dedicated scripting properties (`onTouch`, `onDraw` and `onResize`) that work like the `onValue` property : they are used to defined scripts that will be executed when specific events occurs.
This widget requires a good understanding of the javascript [Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and of the javascript programming language in general.
## Canvas properties
### `valueLength`
This property must be set to the number of values held by the widget : 1 for a simple slider, 2 for an XY pad, etc. Attempts to set the widget's value with a different number of values will be ignored.
```js
set("this", 1) // works if valueLength == 1
set("this", [1, 2]) // works if valueLength == 2
```
### `autoClear`
This is a convenience option that clears the canvas context and calls [`beginPath`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/beginPath) before each drawing. When this property is set to `false`, the canvas must be cleared manually.
### `continuous`
If this property is enabled, the widget will be redrawn at a fixed rate even if not interacted with (see [`onDraw`](#onDraw)).
### `onTouch`
This script is executed when the widget is touched, when it is released, and during the movement of the pointer while the widget is touched.
This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following:
- `value`: widget value
- `width`: canvas width in pixels
- `height`: canvas height in pixels
- `event`: object containing the following:
- `type`: `"start"`, `"move"` or `"stop"`
- `target`: id of the widget under the pointer, `"this"` if it's the canvas widget itself, `null` if no widget is under the pointer
- `targetName`: name attribute of the html element under the pointer
- `targetTagName`: tag name of the html element under the pointer
- `offsetX`, `offsetY`: touch coordinates in pixels, relative to the html element under the pointer
- `movementX`, `movementY`: movement of the pointer in pixels since the last event
- `pageX`, `pageY`: touch coordinates in pixels, relative to the page
- `pointerId`: unique identifier used to differentiate fingers in multitouch situation
- `altKey`, `ctrlKey`, `shiftKey`: keyboard modifier states
- `force`: amount of pressure applied to the touch surface between `0` and `1` (see [Touch.force](https://developer.mozilla.org/en-US/docs/Web/API/Touch/force)). Equals `0` if the API is not supported or if no pressure information is found.
- `radiusX`, `radiusY`, `rotationAngle`: see [Touch.rotationAngle](https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle)
- (iOS only) `altitudeAngle`, `azimuthAngle`: see [Touch.altitudeAngle](https://w3c.github.io/touch-events/#dom-touch-altitudeangle)
- (iOS only) `touchType`: "direct" or "stylus"
!!! note "Extra html elements"
Elements added using the `html` property can be touched as well, `event.targetName` can be used to determine which element is touched.
### `onDraw`
This script is executed when the widget should be redrawn, which is when it's touched and when it receives a value.
This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following:
- `value`: widget value
- `width`: canvas width in pixels
- `height`: canvas height in pixels
- `ctx`: [canvas rendering context](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) of the widget
- `cssVars`: object containing the computed value of some of the widget's style properties such as `colorWidget`, `alphaFill`, `padding`, etc
In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates.
### `onResize`
This script is executed when the widget has resized, before it is redrawn.
This script has access to the same variables and functions as the `onValue` property (except the event-specific ones), plus the following:
- `value`: widget value
- `width`: canvas width in pixels
- `height`: canvas height in pixels
- `cssVars`: object containing the computed value of some of the widget's style properties such as `colorWidget`, `alphaFill`, `padding`, etc
## Example: XY pad
Let's create a simple xy pad, with a value made of two numbers between 0 and 1. We set `valueLength` to `2` to make sure the widget only accepts incoming messages with two values (x and y).
First, we use the `onTouch` property to store the touch coordinates in the `locals` object. We also call `set()` to store these in the widget's value (this way, the widget can send messages and sync with other widgets).
```js
// onTouch
// store normalized coordinates
if (event.type == "start") {
locals.x = event.offsetX / width
locals.y = event.offsetY / height
} else {
// when the pointer is moving, increment coordinates
// because offsetX and offsetY may not be relevant
// if the pointer hovers a different widgets
locals.x += event.movementX / width
locals.y += event.movementY / height
}
// update widget value and send
set("this", [locals.x, locals.y])
```
Then, we use the `onDraw` property to draw a circle at the touch coordinates.
Fragments allow breaking sessions into multiple files and reusable components made of multiple widgets.
##Fragment files
When right-clicking on a widget in the editor mode, it is possible to export it as a fragment file.
Fragment files have the same extension as session files (`.json`) and can be opened like regular sessions. When doing so, keep in mind that only the first child of the root widget will be saved. It is possible to save a fragment file as a session file (and vice versa) by toggling the `Fragment mode` in the main menu.
## Fragment widgets
Fragment widgets work like clone widget except their source widget are loaded from fragment files or session files. When the sources files are modified, the fragment widgets are updated automatically.
These are interaction events widgets are likely to respond to:
| Mouse | Touch | Description |
|---|---|---|
| Mousedown | Tap | Handled at pressing time, not releasing. |
| Click | Click | Handled at release time. |
| Double Click | Double Tap | Some widgets handle double click / double tap events.|
| Drag | Drag |The widgets respond to mouse and touch drag gestures with a 1:1 precision ratio. |
Widgets sensibility can be tuned with the `sensibility` property. Single-touch widgets (i.e. all widgets except `mutlixy` and `range`) also accept an alternate interaction event for fine control.
| Mouse | Touch | Description |
|---|---|---|
| `Ctrl` + Drag | / | Holding the `Ctrl` key while dragging with the mouse increases the gesture's precision by 10.|
| / | Two-fingers drag |Using two fingers on a single-touch target increases the gesture's precision by 10. |
## Sending messages
When interacted with, widgets with at least one target (including the server's defaults) send osc messages of the following form:
```
/address ...preArgs ...value
```
If they have MIDI targets, the server will try to convert the osc messages into a MIDI messages (see [MIDI messages](../midi/midi-messages.md)).
## Receiving messages
When an osc message is received, it updates every widgets that meets the following conditions
- same `address`
- same `preArgs` (no distinction between integers and round floats )
The remaining arguments after `preArgs` are passed to the widget.
When a MIDI message is received, it's converted into an osc message (see [MIDI messages](../midi/midi-messages.md)) and follows the same rules, except that only the widgets that include the emitting MIDI device in their targets will be able to receive it.
##Widget synchronization
Within a single client's scope, there are multiple ways to synchronize widgets:
- If they share the same `id`: in this case, the synchronized widget doesn't send any osc/midi message. This case is mostly used for widget cloning.
- If they share a `linkId`: in this case, the synchronized widget sends its osc/midi message normally.
- If their `value` properties depend on each other using the [advanced syntaxes](./advanced-syntaxes.md)
- Using [scripting](./scripting.md)
## Client synchronization
From a client to another, widgets are automatically synchronized if they share the following properties:
- `address`
- `preArgs`
- `targets`
Client synchronization can be disabled globally with the `clientSync` [client option](../client-options.md). Widgets with `bypass` set to `true` will not send synchronization messages to other clients.
Widgets can run [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) scripts upon specific events. These scripts are written in special properties under the scripting category.
!!! warning "Advanced syntaxes"
Most [advanced syntaxes](../advanced-syntaxes/) should be avoided as much as possible in scripting properties:
- `@{}`: use `get()` and `getProp()` instead
- `OSC{}`: use `get()` instead (using another widget as receiver)
- `VAR{}`: use `getVar()`instead
- `JS{}` and `#{}` are useless (scripting properties are already interpreted as javascript code) unless you want to generate code procedurally
The editor will always fail to recognize these syntaxes as they don't comply with the javacript language specification, even if the resulting code is valid.
## Events
### `onCreate`
This script is called when the widget is created. If the widget has children, it will be executed after the children are created.
!!! warning "Modifying parent container"
Modifying a non-dynamic property on a parent container from this script **will not work**.
The following variables are available in this context:
- `value`: widget's value
### `onValue`
This script is called when the widget's value updates and when it receives a value.
The following variables are available in this context:
- `id` (`string`): id of the widget that's responsible for the value update
- `value`: widget's value
- `touch`: see [Touch state](#touch-state)
??? infos "Keyboard & Matrix"
In keyboards and matrices, `id` is the id of the child widget that triggered the event, and `value` is an array containing the children's values.
The touched widget's value can be retrieved with:
```javascript
value[getIndex(id)]
```
??? infos "Touch state (deprecated)"
*This feature is deprecated, use `onTouch` instead*
When some widgets are touched or released, a special value event can be caught to trigger custom actions.
If the variable `touch` is not `undefined`, this means it holds the widget's current touch state:
- `0/1` for the widget's touch state (`fader`, `knob` and `xy`, `range` and `multixy`)
- `[i, 0/1]` if the widget is multi touch (`range` and `multixy`). In this case `i` is the touched handle's index, starting with `0`.
```js
if (touch !== undefined) {
// send multi touch state
if (touch.length) send('/touch_address', touch[0], touch[1])
// send global touch state
else send('/touch_address', touch)
} else {
// do something with the value ?
}
```
To avoid unwanted script executions, touch state events will only be caught if the script contains the word `touch` and if `onTouch` is empty.
### `onTouch`
This script is executed when the widget is touched, and when it is released.
This script has access to the same variables and functions as the `script` property (except the event-specific ones), plus the following:
- `value`: widget value
- `event`: object containing the following:
- `type`: `"start"` or `"stop"`
- `handle`: `undefined` if the event concerns the widget, `integer` if it concerns one of it's handles (`multixy` and `range` widgets only)
[Canvas](../canvas/) and containers expose more informations in their `onTouch` script.
??? infos "Containers onTouch"
Containers (root, panel, etc) can monitor touch events happening inside them, it works like with [Canvas](../canvas/#ontouch), with a few differences:
- `event.firstTarget` will return the id of the first touched widget
- setting `event.preventDefault` to `true` will prevent the event from reaching widgets in the container ('start' and 'move' events only)
- setting `event.allowScroll` to `true` will allow touch scrolling where it would normally be prevented ('start' event only)
- setting `event.inertia` will affect 'move' events (works like widget `sensitivity` in reverse (1 = normal, 10 = slow move))
- `width` and `height` are undefined
Containers with `traversing` enabled change how touch events are emitted:
- a new 'stop' event is emitted whenever the pointer exits a touchable widget while pressed.
- a new 'start' event is emitted whenever the pointer enters a touchable widget while pressed.
### `onDraw`
See [canvas](../canvas/).
### `onKeyboard`
*Script widget only*
This script is executed when the key(s) defined in the widget's `keyBinding` property are pressed.
The following variables are available in this context:
- `type` (`string`): `keydown` or `keyup`
- `key` (`string`): key name,
- `code` (`number`): key code
- `ctrl` (`boolean)`: `true` if ctrl key is pressed
- `shift` (`boolean`): `true` if shift key is pressed
- `alt` (`boolean`): `true` if alt key is pressed
- `meta` (`boolean`): `true` if meta key is pressed
### `onPreload`
This script is specific to the root widget, it's called before any other widget is created and can be used to create global variables / functions accessible in other scripts.
In this script, all osc messages emissions are prevented and changing the value of a widget won't trigger widget synchronisation / scripts / advanced syntaxes updates.
## Available variables
The following variables and functions are accessible in this context.
- `console`: javascript console
- `locals`: object for storing/reading arbitrary values. Changing its properties *does not* trigger any synchronisation even if the value is used somewhere else.
- `globals`: same as `locals` but shared between all widgets, contains a few useful variables:
Unlike in most javascript contexts, the special keyword `this` doesn't point to an object but instead returns the string `"this"`.
----
#### `get(id)`
- `id`: widget `id` as a string.
Returns the value of the first matching widget. If the returned value is an object, a copy is returned to allow safe mutation.
----
#### `set(id, value, options)`
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. `id` may contains wildcards ('\*').
- `value`: new value for the widget.
- `options` (optional): `object`, accepts the following items:
- `sync: false`: prevents widgets from triggering synchronization and scripts
- `script: false`: prevents scripts but not synchronization
- `send: false`: prevents widgets from sending osc messages
- `external: true`: simulates a value coming from an osc/midi message (implies `send: false` automatically)
Sets the value of the first matching widget. If `ìd` contains wildcards, affects all matching widgets **except** the emitting widget.
If the event that triggered the script's execution was initiated by a user interaction, this will make the widget send its value as well (unless `options` is set to `{send: false}`).
----
#### `getVar(id, name)`
- `id`: widget `id` as a string.
- `name`: variable name as a string.
Returns the value of a widget's custom variable. If the returned value is an object, a copy is returned to allow safe mutation.
----
#### `setVar(id, name, value)`
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget. `id` may contains wildcards ('\*').
- `name`: variable name as a string.
- `value`: new value for the variable.
Sets the value of a widget's custom variable (see [advanced syntaxes](./advanced-syntaxes.md##ustom-variables-varvariablename-default)). If `ìd` contains wildcards, affects all matching widgets.
----
####`send(target, address, ...args)`
- `target` (optional): `"ip:port"` or `"midi:device_name"` string. If omitted, the widget's target (or the server's defaults) will be used.
- `address`: osc address, must start with a `/`
- `args`: values or `{type: "OSC_TYPE_LETTER", value: VALUE}` objects
Sends an osc message.
If the event that triggered the script's execution was not initiated by a user interaction, this function will have no effect.
This function ignores the widget's `bypass` and `ignoreDefaults` properties.
??? infos "Examples"
```javascript
send('127.0.0.1:4444', '/address', 1)
send('127.0.0.1:4444', '/address', 1, 2)
send('/address', 1) // uses the widget's target
send('/address', {type: 'i', value: 1}) // sends 1 as an integer
```
----
#### `getProp(id, name)`
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget.
- `name`: property name.
Returns the property called `"name"` of the first matching widget. If the returned value is an object, a copy is returned to allow safe mutation.
----
#### `getIndex(id)`
- `id` (optional): widget `id` as a string. Defaults to `"this"`.
Returns the widget's index in its container.
----
#### `updateProp(id, name)`
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget.
- `name`: property name.
Forces a widget to check if one of its properties has changed and update itself if needed.
----
#### `updateCanvas(id)`
- `id`: widget `id` as a string. Can be `"this"` to target the host widget.
Forces a canvas widget redraw.
----
####`httpGet(url, callback)`
- `url`: url of the resource to fetch (local url only)
- `callback`: function executed when/if the http request succeeds, with the response text as argument
----
#### `stateGet(id)`
- `id`: widget `id` as a string, or array of `id` strings. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget.
Returns a state object (`id:value`) for matching widget and all their children.
----
#### `stateSet(state, options)`
Loads a state object. If the event that triggered the script's execution was initiated by a user interaction, this will make the updated widgets send their value as well.
- `options` (optional): `object`, accepts the following items:
- `send: false`: prevents widgets from sending osc messages
----
#### `storage`
Global [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) instance, allows storing data that persists upon refresh/relaunch.
These work like almost their native equivalent, with an extra (optional) `id` argument.
- `id` (optional): unique identifier, if omitted, defaults to `undefined`. If a timeout with the same id is already running, it is cleared before the new one is created (even if `undefined`). `id`s are scoped to the widget's context: two timeouts with the same `id` in two different widgets can run concurrently
Gives focus to a widget (ie input widget). If `id` is omitted or falsy, currently focused element will be unfocused.
*Built-in client only*: tells the operating system to give the focus to the client window
----
#### `unfocus()`
*Built-in client only*: tells the operating system to give the focus to the window that was focused before.
----
#### `setFocusable(focusable)`
- `focusable`: `0` or `1`
*Built-in client only*: define whether the client window can be focused or not. Text inputs cannot be interacted with when the window is not focusable.
----
#### `getScroll(id)`
- `id`: widget `id` as a string.
Returns the scroll position of a container as a `[x, y]` array.
----
#### `setScroll(id, x, y)`
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget.
- `x`: horizontal scroll, `undefined` to use current value
- `y`: vertical scroll, `undefined` to use current value
Sets the scroll state of a container.
----
#### `scrollIntoView(id, option)`
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget.
- `option`: `alignToTop` or `options` argument as defined in https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
Scroll containers to make widget(s) visible.
----
#### `toolbar(id)`
- `id` menu entry id (string)
Triggers toobar action if currently available (ie accessible from the menu). `id` can be one of the following:
Some actions will only be triggered if initiated with a physical user interaction, check the console for errors if it doesn't work as expected.
=== "Legacy syntax: `toolbar(i1, i2, ...)`"
- `iX`: menu entry index
Triggers toolbar action at specified index.
!!! example "Examples"
- `toolbar(0, 0)` -> Open a new session
- `toolbar(4)` -> Toggle full screen
----
#### `getToolbar(id)`
- `id` menu entry id (string)
Returns `true` if the toolbar entry exists and is currently activated.
#### `openUrl(url)`
- `url`: http(s) url
*Built-in client only*: opens url with the system's default browser
*External client only*: opens url in a new tab
If the event that triggered the script's execution was not initiated by a user interaction, this function will have no effect.
----
#### `runAs(id, callback)`
- `id`: widget `id` as a string.
- `callback`: function to be executed
Run `callback` function as if executed by another that widget matches specified id. This will not change the value of any local variable but `"this"` and `"parent"` arguments (accepted by functions such as `set()`) will be interpreted differently. Timeouts and intervals will be created and cleared in the target widget's scope.
----
#### `reload(keepState)`
- `keepState` (optional): `true` by default, set to false to discard the client's state.
Reload the client application. Cannot be called from the `onCreate` property.
If the event that triggered the script's execution was not initiated by a user interaction, this function will have no effect.
----
#### `getNavigator()`
Returns the instance of [Navigator](https://developer.mozilla.org/en-US/docs/Web/API/Navigator).
----
#### `browseFile(options, callback)`
Opens the server file browser and pass selected file to a callback function (does not create nor read files by itself).
- `options`: object with the following keys:
- `extension`: allowed extension (default: "*")
- `directory`: starting directory for browser (default: user's home)
- `allowDir`: allow choosing a directory instead of a file (default: false)
- `mode`: "save" or "open"
- `callback`: function called with 1 argument (file path)
#### `uploadFile(options, callback)`
Opens the client file upload prompt and pass the raw content of selected file to a callback function.
- `options`: object with the following keys:
- `types`: equivalent of HTML attribute [`accept`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/accept)
- `callback`: function called with 1 argument (file content)