Your first theme
A page, a clock, a dock and a swipe: the smallest theme that is actually a theme.
On this page
This walks through the smallest thing worth calling a theme: one page with a clock and a row of apps, and a second page you reach by swiping. Roughly four minutes in the editor. The JSON is shown alongside, because reading it once makes every later page of this manual easier.
1. A page#
Every theme starts as one page of type home. In the document that is:
{
"version": 2,
"meta": { "name": "First theme" },
"pages": [
{ "id": "home", "name": "Home", "pageType": "home", "components": [] }
],
"defaultPageId": "home"
}2. A clock#
Add a text element and put a formula in its text field:
$format(time_hour, '00')$:$format(time_minute, '00')$Everything between two $ signs is evaluated; everything outside is literal, which is why the colon in the middle survives. format(…, '00') is what turns 7 into 07. Without it the clock reads 9:7 for a minute every hour.
{
"id": "clock", "type": "text",
"x": "24", "y": "120", "fontSize": "64", "fontWeight": "light",
"text": "$format(time_hour, '00')$:$format(time_minute, '00')$"
}Positions and sizes are formulas too, which is why they are strings. "y": "120" is simply a formula with no variables in it.
3. A dock#
A dock is an app grid with fixed slots: one row, pinned near the bottom:
{
"id": "dock", "type": "app_grid",
"x": "0", "y": "$screen_height - 110$",
"width": "$screen_width$", "height": "88",
"appMode": "manual", "gridColumns": "4", "showLabels": false,
"appSlots": "[\"role:default_phone\",\"role:default_browser\",\"role:default_mail\",\"role:default_camera\"]"
}Note role: rather than package names. A slot filled with a role points at whatever app the user has chosen for that job, so the dock works on a phone you have never seen. Fixed package names are allowed, but a theme built on them shows gaps on devices that do not have those apps.
Note also "y": "$screen_height - 110$". A dock positioned with a fixed number sits in the wrong place on the next device. See different screens.
4. A second page, and the swipe that reaches it#
Add a page, then draw a link between the two in the page overview. A link records which edge of each page it is plugged into, and that edge says where the neighbour lies:
"pages": [
{ "id": "home", "pageType": "home", "column": 0, "row": 0, "components": [] },
{ "id": "apps", "pageType": "home", "column": 0, "row": 1, "components": [] }
],
"pageLinks": [
{ "from": "home", "fromSide": "bottom", "to": "apps", "toSide": "top", "transition": "cover" }
]Swiping up from home now opens apps, and swiping down from apps goes back. The transition decides how it moves. cover means the arriving page fills the screen and takes the dock with it, which is what you want for a full-screen app list. See pages and links.
5. Make it react#
Change one thing so the theme stops being a picture. Give the clock an opacity that follows the swipe:
"opacity": "$clamp(1 - abs(page_position), 0, 1)$"page_position is 0 while this page is centred and moves toward ±1 as you swipe away from it. The clock now fades out as you pull the app list up, and comes back as you let it go, without any animation being defined, because there is nothing to define. The value simply depends on where the page is.
That is the whole idea of the format. Once you have it, read formulas for the rest.
Documentation for launcher 0.1.0-alpha Android 12 and later last updated