-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathexample.star
39 lines (35 loc) · 916 Bytes
/
example.star
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
load("encoding/json.star", "json")
load("render.star", "render")
load("schema.star", "schema")
DEFAULT_LOCATION = """
{
"lat": "40.6781784",
"lng": "-73.9441579",
"description": "Brooklyn, NY, USA",
"locality": "Brooklyn",
"place_id": "ChIJCSF8lBZEwokRhngABHRcdoI",
"timezone": "America/New_York"
}
"""
def main(config):
location = config.get("location", DEFAULT_LOCATION)
loc = json.decode(location)
timezone = loc["timezone"]
return render.Root(
child = render.Marquee(
width = 64,
child = render.Text("tz: %s" % timezone),
),
)
def get_schema():
return schema.Schema(
version = "1",
fields = [
schema.Location(
id = "location",
name = "Location",
desc = "Location for which to display time.",
icon = "locationDot",
),
],
)