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

+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));