Skip to content
AtsuraeDownload

Development sign-in

Only on a local server with DEV_AUTH. Enter any account name.

Greeting

A script picks the greeting by the hour, and adds the name typed in the widget’s Your name option.

The Greeting widget

Download Greeting.atsuraewidget and drop it on the Widgets section of your Library, or create the files yourself:

Greeting.atsuraewidget/widget.json
{
"$schema": "https://atsurae.app/docs/schema/widget.schema.json",
"formatVersion": 2,
"id": "greeting",
"name": "Greeting",
"summary": "Good morning, afternoon or evening, with your name.",
"author": "Atsurae",
"version": "1.0",
"options": [
{ "key": "name", "label": "Your name", "kind": "text", "defaultValue": "" }
],
"script": { "file": "script.js", "updateEvery": "minute" },
"elements": [
{ "text": "{script.greeting}", "font": { "size": 0.045, "weight": "semibold" } },
{ "text": "{weekday}, {monthName} {day}", "font": { "size": 0.018, "weight": "regular" }, "opacity": 0.8, "offset": [0, 0.045] }
]
}
Greeting.atsuraewidget/script.js
function update(context) {
const hour = context.now.getHours();
let greeting = "Good evening";
if (hour < 5) greeting = "Good night";
else if (hour < 12) greeting = "Good morning";
else if (hour < 18) greeting = "Good afternoon";
// Options arrive as text. An empty name leaves just the greeting.
const name = context.options.name.trim();
return { greeting: name ? `${greeting}, ${name}` : greeting };
}
  • context.now.getHours() is the hour in your time zone, 0–23.
  • The name option is a text option with an empty default. Options always arrive as strings, so .trim() is safe.
  • The date line uses tokens directly; only the greeting needs the script.
  • Add greetings for weekends: context.now.getDay() is 0 on Sunday and 6 on Saturday.
  • Use an emoji per time of day: 🌅 ☀️ 🌆 🌙.
  • Translate it: use a choice option for the language.