Remove the built-in clock and date from the home screen

Home is now fully blank apart from the Windows panel; add a clock widget
for the time. Drops the clock_time/clock_date imports, the TICK message
and its 5s timer, the shell's tick() on resume and is24Hour().

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KxeCBaCjz7Sp1PhdznewhY
This commit is contained in:
Claude committed 2026-10-21 23:54:01 +00:00
1 parent d7bd24b817
commit ce815d72c2
7 files changed
+13 -75

No files matched your search

+3 -36
View File
@@ -54,18 +54,7 @@ def open_recents() -> None:
def haptic() -> None:
pass
@jscall
def clock_time(dst: i32) -> None:
"""Write the local time ("15:04") into dst."""
pass
@jscall
def clock_date(dst: i32) -> None:
"""Write the local date ("Tuesday, October 21") into dst."""
pass
# ---- Msg (index.html and MainActivity.java send TICK through WIDGET_MENU)
TICK: Const[i32] = 1
# ---- Msg (index.html and MainActivity.java send RELOAD through WIDGET_MENU)
RELOAD: Const[i32] = 2
HOME: Const[i32] = 3
BACK: Const[i32] = 4
@@ -151,8 +140,6 @@ chosen: i32 = -1 # widget row being added
query: i32 = 0
wquery: i32 = 0 # widget picker search
now: i32 = 0
today: i32 = 0
err: i32 = 0
notice: i32 = 0
notice_gen: i32 = 0
@@ -168,14 +155,12 @@ pending: i32 = 0 # JSON handle of a request in flight
def init() -> None:
global query, wquery, now, today, err, notice, scratch, nh, next_key, pending
global query, wquery, err, notice, scratch, nh, next_key, pending
i: i32
h: i32
k: i32
query = s_new()
wquery = s_new()
now = s_new()
today = s_new()
err = s_new()
notice = s_new()
scratch = s_new()
@@ -194,9 +179,6 @@ def init() -> None:
nh += 1
else:
s_free(h)
clock_time(now)
clock_date(today)
after(5000, TICK, 0)
pending = http_get("apps.json", LOADED)
@@ -562,11 +544,6 @@ def update(msg: i32, arg: i32) -> None:
elif msg == NOTICE_DONE:
if arg == notice_gen:
s_clear(notice)
elif msg == TICK:
clock_time(now)
clock_date(today)
if arg == 0:
after(5000, TICK, 0)
elif msg == RELOAD:
pending = http_get("apps.json", LOADED)
elif msg == HOME:
@@ -675,7 +652,7 @@ def view_home_slot(i: i32) -> None:
def view_panel() -> None:
"""The panel under the clock: shortcuts to system surfaces."""
"""The panel at the top of home: shortcuts to system surfaces."""
el("section")
cls("panel")
attr("aria-label", "Shortcuts")
@@ -705,16 +682,6 @@ def view_home() -> None:
on_click(OPEN_DRAWER, 0)
end()
el("header")
cls("clock")
div("time")
text_ref(now)
end()
div("date")
text_ref(today)
end()
end()
view_panel()
el("ul")
BIN
View File
Binary file not shown.
+1 -14
View File
@@ -33,18 +33,9 @@
pickWallpaper: () => toast("Pick a wallpaper"),
openRecents: () => toast("Show open windows"),
haptic: () => navigator.vibrate?.(10),
is24Hour: () => false,
};
if (!window.Android) document.documentElement.classList.add("demo");
let fmtTime, fmtDate;
const formats = () => {
fmtTime = new Intl.DateTimeFormat(undefined,
{ hour: "numeric", minute: "2-digit", hourCycle: host.is24Hour() ? "h23" : "h12" });
fmtDate = new Intl.DateTimeFormat(undefined, { weekday: "long", month: "long", day: "numeric" });
};
formats();
// Tell the shell where the live widget slots are (CSS px, viewport-relative).
let placed = "";
const place = () => {
@@ -114,13 +105,11 @@
pick_wallpaper: () => host.pickWallpaper(),
open_recents: () => host.openRecents(),
haptic: () => host.haptic(),
clock_time: (h) => { strs[h] = fmtTime.format(new Date()).replace(/\s?[AP]M$/i, ""); },
clock_date: (h) => { strs[h] = fmtDate.format(new Date()); },
}),
});
// Messages the shell and the gestures below send (keep in sync with app.py).
const TICK = 1, RELOAD = 2, HOME = 3, BACK = 4, SWIPE_DOWN = 5, SWIPE_UP = 6,
const RELOAD = 2, HOME = 3, BACK = 4, SWIPE_DOWN = 5, SWIPE_UP = 6,
WIDGET_ADDED = 7, WIDGET_MENU = 8, DRAG_TO = 35, DROP = 36, RESIZE = 40;
// Dragging a home slot. A long press lifts it (app.py marks it .lifted); moving the
@@ -220,7 +209,6 @@
addEventListener("touchmove", (e) => { if (rs && e.cancelable) e.preventDefault(); }, { passive: false });
window.ultraHome = {
tick: () => { formats(); app.dispatch(TICK, 1); },
reload: () => app.dispatch(RELOAD, 0),
home: () => { app.dispatch(HOME, 0); window.scrollTo({ top: 0, behavior: "smooth" }); },
back: () => app.dispatch(BACK, 0),
@@ -232,7 +220,6 @@
resetIcons: () => { iconSrc.clear(); asked.clear(); tries.clear();
for (const img of document.querySelectorAll("img.icon")) img.__icon = undefined; },
};
document.addEventListener("visibilitychange", () => { if (!document.hidden) window.ultraHome.tick(); });
addEventListener("scroll", () => requestAnimationFrame(place), { passive: true });
addEventListener("resize", () => requestAnimationFrame(place));
-5
View File
@@ -21,11 +21,6 @@ body { margin: 0; min-height: 100vh; color: #fff; -webkit-tap-highlight-color: t
.pull::before { content: ""; display: block; width: 2.25rem; height: .3rem; margin: auto;
border-radius: 999px; background: rgb(255 255 255 / .45); }
.clock { text-align: center; text-shadow: 0 1px 8px rgb(0 0 0 / .45); margin-bottom: 2rem; }
.clock .time { font-size: 4rem; font-weight: 200; line-height: 1; letter-spacing: -.02em;
font-variant-numeric: tabular-nums; }
.clock .date { margin-top: .5rem; font-size: 1rem; opacity: .9; }
.panel { display: flex; gap: .5rem; margin: 0 auto 2rem; padding: .5rem; max-width: 22rem;
border-radius: 1.25rem; background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .16);
backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }