ThemeStore Store Docs FAQ
Documentation

Taps, gestures and state

How an element reacts: triggers, actions, and the variables that carry the result.

On this page

Any element can carry clickActions: a JSON array, held in a string, of trigger/action pairs.

json
"clickActions": "[{\"trigger\":\"tap\",\"action\":\"open_app\",\"value\":\"com.android.chrome\"}]"

Triggers are Tap, Double tap, Long press, Swipe up, Swipe down, Submit and Appear. One element may carry several entries, and a page can carry its own set for taps on the background.

Submit belongs to a text field and nothing else: it is the keyboard's enter or search key. Adding a submit action is also what makes the keyboard show that key, so a search box needs no button of its own unless you want one.

The value is a formula, evaluated at the moment the action fires, not when the theme is loaded. That is what lets one icon lead somewhere different depending on the time, the feed entry it belongs to, or a variable something else set.

The full list of actions is on click actions.

Leave a way back in#

The sheet that holds Open editor, Themes and Settings is not part of the launcher's chrome. It opens because something in the theme carries the launcher_settings action, and a theme that carries it nowhere has no way to reach it.

The themes shipped with the launcher put it on a long press of the background page, which is why that gesture feels built in. It is not. Two ways to lose it:

  1. Leave the action out of your background page.
  2. Cover the background completely, so there is no empty spot left to press. A full bleed feed page arriving with a cover transition does exactly this.

Nobody is truly locked out. The same options open as a full screen from two places no theme can switch off: the launcher's own entry in the app list, and App settings in the system app info screen. But a reader who has to go looking for that has already decided your theme is broken, so give the action a home:

  • a long press on the background page, the convention readers expect
  • a settings row at the end of an app list, using Show settings entry on a list layout
  • an element of your own carrying the action, if your theme has a place for it

Check it in preview mode before you publish, from every page, including the ones that cover everything.

State is a variable#

There is no event system beyond set_variable. An action writes name=value, every formula reading name re-evaluates, and that is the entire mechanism:

json
"clickActions": "[{\"trigger\":\"tap\",\"action\":\"set_variable\",\"value\":\"panel=open\"}]"
json
"hidden": "$panel != 'open'$"

Writing without an = clears the variable. A tap that toggles is one expression: "value": "panel=$panel == 'open' ? '' : 'open'$".

Declare the starting values under globalVariables so the theme behaves the same on its first run as on its hundredth.

Text input#

A text field writes what is typed into the variable named in Write to variable. That makes a search box two things rather than three: the field, and a Submit action on it that opens $default_search_url$, the engine the reader chose rather than one you picked for them. A separate button is optional.

autoFocus opens the keyboard as the page appears, and clearOnLeave decides whether the text survives leaving the page (on by default; turn it off for something notebook-shaped).

Elements that appear#

An element can act when it appears: an appear trigger is how a page fills a variable, or starts a spring, without waiting for a tap. Combined with scroll_to, which brings a scrolling container to a named section, it is enough to build a page that arrives in a particular state.

What a theme is not allowed to do#

An imported theme is untrusted until you say otherwise, and an untrusted theme may only open a short list of URL schemes: http, https, mailto, tel, sms, smsto, geo, market. Anything else does nothing. Custom intents are stripped of their component, selector and flags.

This is a fixed allow-list rather than a list of blocked schemes, because a blocked-list only covers the schemes somebody thought of. Apps are still launched normally through open_app and app_shortcut, which is what a theme actually needs.

When you import a theme that wants more than the hardening permits, the launcher says so before it is installed, names the scheme, and lets you decide. A theme you built yourself is trusted and runs unfiltered. Themes accepted into the store never contain those schemes at all; see what review checks.

Documentation for launcher 0.1.0-alpha Android 12 and later last updated