Commit Graph
37 Commits
Author SHA1 Message Date
James Babcock a02b849200 Borderless modes have different padding inside the builtin apps
Most of the builtin apps had some padding between the window edge and
their content, because they expect to be displayed with a line border on
their edge. We added a customization option to remove the border, so,
that padding is not always necessary. Make the layouts dynamically
adjust, to omit the padding when it isn't needed.
2026-11-11 15:19:29 -08:00
James Babcock 595b462b2e Merge branch 'main' of https://github.com/jimrandomh/faceclaw into g1-support 2026-11-06 23:33:38 -08:00
James Babcock e1a3e80b3d Terminal: Terminals now default to opening in the same rather than a new window 2026-11-06 23:24:39 -08:00
James Babcock dee60bbcd2 Adapt layouts for Rayneo screen resolution 2026-11-01 19:02:05 -08:00
James Babcock 26e4396972 Multi-row status/app-switcher bar layouts 2026-10-13 00:21:01 -07:00
James Babcock 06146c2b08 Introduce oxlint, and fix lint warnings 2026-09-29 11:54:22 -07:00
James Babcock 2e4d20e130 Clean up unused worker threads for closed apps; other performance optimizations 2026-09-22 14:56:54 -07:00
James Babcock 07828db0bf Refactor texture cache usage to shared Kotlin for iOS 2026-09-20 15:12:13 -07:00
James Babcock ccb320c66f Add tokens and faceclaw-input script, which allows using a CLI utility as an input device for the glasses 2026-09-20 00:34:58 -07:00
James Babcock e50da605e0 Add support for buzzer sound effects on iOS 2026-09-19 12:03:57 -07:00
James Babcock 9e18745e53 Port navigate and weather 2026-09-18 23:46:27 -07:00
James Babcock e8e144f3f2 Merge main into ios-port and update the iOS CFW transport 2026-09-17 23:33:51 -07:00
James Babcock c9e95a3f69 Refinements to bulitin games
All: settings persistence
All: pause on menu
Flappy: both swipe directions trigger flaps
Freecell: skip irrelevant locations
Blocks: Lower speed/difficulty
Pinball: remove the half-implemented Nudge gesture.
2026-09-12 23:50:23 -07:00
James Babcock 70d782a4f1 Build out the glanceboard settings app and widgets
<details>
<summary>Prompts Used</summary>
User: Thanks, looks pretty good. I notice that during the transition from the glanceboard back to off, the glasses display a flash of the main UI. Let's address that.

AI:
> Fixed and built. The cause was the hide order in the glance host: it hid the glance surface first, which made the compositor recomposite and transmit the sleeping UI's retained window frames, and only afterwards did the screen-off path blank the display. That one transmitted frame was the flash.
>
> The hide path in `app/g2/glance-host.ts` now blanks the compositor first and hides the surface second. Blanked, the surface change composites to the same black frame, so nothing extra goes to the glasses. The controller's screen-off path still runs afterwards to drop the wakelock and re-arm the 5-second suspend. Its own blank call is now redundant but harmless.
>
> The double-tap path is unchanged on purpose: there the surface hides while the shell is waking, so the retained UI appearing is the intended result.
>
> Typecheck and the full Android build both pass. I recorded the finding in `notes/glanceboard.md` with a new checklist item for the timeout and release transitions. Worth re-checking on hardware: both the 3-second timeout and the long-press release should now go straight to dark.

<hr>

User: Thanks. Next up, let's make a firmware mod so that we can capture tap and tab-and-hold from deep sleep.

AI:
> Done. Firmware revision 2 forwards tap, long-press, and long-press release from deep sleep, and the phone side consumes them. Everything builds and the tests pass, but nothing is flashed or hardware-tested yet.
>
> **How the firmware does it**
>
> Decompiling the display thread showed that with no app on screen, its touch branch launches the dashboard on double-tap or head-up, launches the stock Menu on tap-then-hold, and frees every other gesture unhandled. The call right after that idle gate at `0x45f01a` has the input record in r4 (raw source at +2, gesture subtype at +4). The new hook in `g2flash/patches/settings_ext.c` wraps that call. When Faceclaw holds the wake lease and the firmware is in the mode where a double-tap would have woken the dashboard, it reports subtype 0 (tap), 3 (long press) and 0xe (release) as settings-sid field-102 events 2, 3 and 4, carrying the raw source. The stock result is returned unchanged, so stock behavior is untouched. Unlike the double-tap wake, nothing stock is deferred, so there is no claim or fallback handshake. I verified in the patched image that the site is a branch into the blob, that the shim hands r4 to the C function, and that the function preserves r4.
>
> **Phone side**
>
> - Java parses the new events into ordinary sys-events with the protobuf source while the page is suspended, so TypeScript sees exactly the soft-sleep gestures and the Glanceboard logic needs no change.
> - The firmware string is now `Faceclaw/2`, the app requires revision 2, and the embedded patch set was regenerated. Onboarding will offer the reflash.
> - A Java test covers the event and source mapping, the wake event staying distinct, and malformed payloads.
>
> **Verification**
>
> | Check | Result |
> |---|---|
> | g2flash `build_cfw.sh` | verified, new output hash pinned |
> | Faceclaw `build.sh` | success |
> | `npm test` | new tests pass; only the pre-existing pinball and compass-style failures remain |
>
> **Two caveats**
>
> - I read "tap-and-hold" as press-and-hold, which is the long-press the Glanceboard uses. The firmware's distinct tap-then-hold gesture still opens the stock Menu app from sleep and is not forwarded. Say so if you wanted that one instead.
> - Only the right lens notifies the phone. A double-tap on either temple wakes both lenses, so left-temple taps very likely reach the right lens's display thread while idle, but that is unverified until it runs on hardware. The checklist in `notes/glanceboard.md` has the new deep-sleep steps and the logcat line to look for.
>
> Nothing is committed in either repository.

<hr>

User: Thanks, that worked. Next up, there's also a screen-on trigger from the accelerometer detecting that you've tilted your head up 45deg. Let's make that trigger go to the glanceboard rather than the main app. (If this requires another firmware extension, go ahead and make it; otherwise use what's already there.)

AI:
> Done. It did need a firmware extension, so this is firmware revision 3 plus matching phone changes. Everything builds and tests pass; nothing is flashed or hardware-tested yet.
>
> **Why firmware was needed.** In deep sleep the head-up already reached the phone, but through the same deferred-wake event as a double-tap, so the phone could not tell them apart. In soft sleep, the first five seconds after the screen goes dark, the head-up never reached the phone at all: the display thread's idle gate drops it while an EvenHub page is on screen.
>
> **Firmware, revision 3**
>
> - **Deep sleep.** The idle policy's head-up display-start site now goes through its own wrapper. It runs the identical deferred-wake claim-and-ready handshake but reports field-102 event code 5 instead of 1. One deliberate difference: a head-up while a wake is already pending is ignored, instead of the double-tap's emergency stock-dashboard launch, so lifting your head right after a tap cannot flash the stock dashboard.
> - **Soft sleep.** The idle-gate call is wrapped, ported from the old head-tilt branch with two extra guards mirroring the stock idle path: the glasses' head-up switch must be on and the stock busy check must be clear. It forwards the head-up as EvenHub sys-event 12 under the framebuffer lease.
> - Both hooks and the two wrappers were verified by disassembling the patched image. The output hash is pinned and the embedded patch set in Faceclaw is regenerated.
>
> **Phone side**
>
> - Java decodes wake code 5 as a display-wake carrying the head-up event type, and rewrites the soft-sleep sys-event 12 into the same thing. The Glanceboard logic from earlier already treats that as a press, so a head-tilt now shows the board for the timeout instead of waking the main UI. With the Glanceboard toggle off, a head-tilt still wakes the regular UI as before.
> - The app now requires firmware revision 3, so onboarding will offer the reflash.
> - The Java test covers the new wake code alongside the tap, long-press, and release events.
>
> **One thing left as is.** Faceclaw does not push the head-up switch or angle to the glasses. The trigger uses whatever the Even app configured, which is what you have today. The old branch's setting for that is not merged.
>
> The hardware checklist in `notes/glanceboard.md` has the four head-tilt cases: deep sleep, soft sleep, screen on, and head-tilt right after a double-tap.

<hr>

User: Thanks. Next up, let's make a glanceboard widget for the Calendar.

AI:
> Waiting on the Android build; the widget, its registration, and the notes are done.

<hr>

User: Thanks. Next up, let's make a glanceboard widget for the Terminal app. This will show the same terminals (including, especially, activity indicators) as the terminal list window and reuse some code from it. If the window title is too long to fit, we truncate rather than wrap.

Also, if a terminal has a window open, that window's number will be shown in a left column in the terminals list (both the terminal-list window version and the glanceboard version). This will replace the "[open]" tag currently at the end of the line.

<hr>

User: Continue

AI:
> The Terminal widget is in, the hub list has the new number column, and the build passes. Not yet tried on hardware.
>
> **Getting the list to the main thread.** The Terminal app lives in a worker, so the widget cannot read its state directly. I added a small generic channel: a worker can post a `publish-state` reply with a key and a JSON value, and the host stores it in a main-thread registry with change notifications. The Terminal worker publishes a session snapshot under `terminal:sessions` whenever the hub would repaint, deduplicated by content. Each row carries its label, the open view window's sidebar glyph, and an activity deadline in the phone's clock, so the widget can blink and expire indicators on its own 800 ms timer without further messages.
>
> **Shared row painter.** `app/apps/terminal/session-list.ts` now holds one `drawSessionRow` used by both the hub and the widget: activity square in the gutter, the window number column, then the label truncated to fit, never wrapped. The hub used to draw labels untruncated, so it gains that too.
>
> **The number column.** A session with an open view window now shows that window's sidebar glyph, "1", "2" and so on, in a column left of the label, in both the hub and the widget. The "[open]" suffix is gone from the list. The assistant's list-sessions tool text says "[open in window 2]" instead.
>
> **Widget layout** at 288x144: "Terminal" label, then host headings only when more than one host is connected, then session rows, as many as fit. Empty states cover no connections, connecting, and no live sessions.
>
> **One limitation to know about.** The snapshot exists only once the Terminal app has been opened in this app session, because that is when the worker and its g2mirror control clients start. Before that the widget says to open the Terminal app. Since the shell restores open apps at boot, a hub left open carries across restarts. Making the worker start its control clients at boot without a window is a possible follow-up if you want the widget live from launch.
>
> Checklist entry 7c in the design note covers the blink sync, the number column in both views, and truncation. Nothing is committed.

<hr>

User: Thanks. Next up, let's make it so that selecting a widget for a slot that's already used in another slot clears that slot, _except_ that certain widgets that support it can occupy both left slots or both right slots, in which case they render at double height and the line between the slots is removed. We'll implement double-height for the Terminal and Calendar widgets.

AI:
> Done. Slot uniqueness and double-height regions are in, with a node test for the pure part, and the build passes.
>
> **The rule** lives in two places that share one adjacency helper in the layout module:
>
> - **When a picker changes**, the config app clears every other slot holding the same widget, unless the widget is marked tall and that slot is vertically adjacent to the one just chosen. So picking Terminal for Bottom left while it is in Top left keeps both, and then picking it for Top right clears both left slots. This runs from the picker's change hook and goes through the settings broadcast, so the board and the other rows follow on their own.
> - **When the board paints**, it resolves the slot choices into regions. A tall widget in two vertically adjacent slots becomes one 288x288 region and its widget gets the taller canvas. Dividers are drawn per region, so the line between the merged slots disappears.
>
> **Tall widgets.** Terminal and Calendar are marked tall. Both already lay out rows until they run out of height, so at double height they simply show more sessions or more events with no widget code changes. The other widgets stay single-slot.
>
> **Region diffing.** The board keys live regions by widget plus slots and restarts only what changed on a settings change. Switching a widget from single to tall restarts just that widget; unrelated widgets keep their subscriptions and hardware holds.
>
> **Verification.** `tests/glanceboard-layout.test.cjs` covers adjacency, left and right merges, non-spanning and diagonal duplicates staying separate, and empty boards. Typecheck and the Android build pass. The design note has a checklist step for the three picker cases. Nothing is committed.

<hr>

User: Thanks. Let's organize the Glanceboard configuration app into several screens. The entry page will have a title, a paragraph of text describing how the glanceboard works, and a menu with an "Enable Glanceboard" toggle, Preview, Select Contents, and Settings. Settings will contain:
 * "Show on tap", which instead of a toggle will be a duration (from a list of options 3s, 5s, 7s, 10s, default 5s)
 * "Show on long press", which will be a toggle
 * "Show on head tilt", which will be a toggle
 * "Show lines", which will toggle visibility of the quadrant-separator lines

Fable 5.1:
> The Glanceboard app is now three screens, the four settings are wired through, and the build and tests pass.
>
> **Entry page.** Title, a short paragraph on how the board works, and a menu drawn on the same page below it: Enable Glanceboard (toggle, the existing setting relabeled), Preview, Select Contents, Settings. Double-tap on the entry page yields to the sidebar as before; on the sub-screens it goes back.
>
> **Select Contents** is the slot pickers page from before, including the one-widget-per-board rule and double-height merging.
>
> **Settings** holds:
>
> - **Show on tap**: a duration picker, 3, 5, 7 or 10 seconds, default 5. The head-tilt uses the same duration since it behaves as a tap.
> - **Show on long press**: toggle. Off means a hold while asleep does nothing. A release still passes through so a hold already in progress can end.
> - **Show on head tilt**: toggle. Off sends the head-tilt wake to the regular UI, the pre-Glanceboard behavior.
> - **Show lines**: toggle for the slot dividers.
>
> **Wiring.** The gesture policy moved out of the controller into the glance host, which asks the board provider for the four values. The timeout is handed to the state reducer per event, so the pure module stays testable; a new test covers the supplied timeout. The master toggle off still makes every sleep gesture a no-op.
>
> The design note's checklist has a step per setting. Nothing is committed.

<hr>

User: Thanks. Let's maket the menu half width, and use the space on the right for a preview with the quadrant-separator lines and the title of what's in each slot. Instead of "Select Contents" opening a separate page, it will move the focus to that view, so you can pick one of the quadrants there and tap to open a menu of what goes in that quadrant. The four-quadrants preview will show the lines between them; if the show-lines setting is disabled, they'll be reduced to min brightness and dotted (every other pixel). The preview will omit the line between quadrants as appropriate for double-height views.

Fable 5.1:
> The entry page now has the half-width menu on the left and the slot preview on the right, with Select Contents working inside the preview. Build and tests pass.
>
> **Preview.** The right half shows the board scaled down with its slot dividers and the name of the widget in each region, or "Empty". A double-height region shows one name and no line across it. With "Show lines" off, the dividers drop to the dimmest visible shade and light only every other pixel, so the layout still reads but signals off.
>
> **Select Contents.** Choosing it moves focus into the preview instead of opening a page. Scroll moves a highlight between the four quadrants, a tap opens a modal picker for that slot with the current choice marked, and picking applies the same one-widget-per-board rule as before. The preview updates as soon as a choice lands. Double-tap returns focus to the menu. While the preview has focus the menu's selection shows as outline only, following the shell's convention that a filled selection means it has input.
>
> **Shared geometry.** The divider layout moved out of the board into a pure helper in the layout module, so the live board and the preview draw the same lines, including the merged-region rule. A new test pins the four-slot and tall-Terminal cases.
>
> The design note's checklist has a step for the preview interactions. Nothing is committed.

<hr>

User: Thanks. One fix: while the quadrants-preview is selecte, double-tap back currently goes to the app-switcher, but should go to the glanceboard menu. We can also remove the gesture-help below the preview.

Fable 5.1:
> Fixed and built. The cause was the root wrapper that turns any double-tap at the app's root into a yield to the sidebar, which ran before the page could see the gesture.
>
> The home page is now the window's root without that wrapper and routes double-tap itself: with the preview focused it returns focus to the menu, with the menu focused it yields to the sidebar as before. The gesture hint under the preview is gone.
>
> Typecheck and the Android build pass. Nothing is committed.

<hr>

User: Thanks, looks good.
Let's make the lines in the glanceboard (on the real glanceboard, not the configuration widget) dimmer.
In the Terminal glanceboard widget, with my configured font size (Roboto Light 12), there is room for one more row. It does seem to be responsive (when I increased the font size to 18 the row count dropped accordingly) but the bottom boundary might be above where it could be.
Let's add IOB to the Nightscout glanceboard widget. Also include any of cannula age, cartridge volume, battery voltage, and time since last loop that breach the limits configured in Nightscout settings (if they aren't already included), and double check that the glucose value is crossed out if it's too old.

Fable 5.1:
> All three done, typechecked and built.
>
> **Dimmer lines.** The live board's dividers dropped from shade 40 to 20, the dimmest level that survives the 4-bit quantization. The configuration preview keeps its own brighter lines.
>
> **Terminal rows.** The bottom bound was stricter than it needed to be: it required a full line step, which includes inter-line spacing, to fit above an 8 px bottom pad. Rows are still placed a step apart, but the last one now only needs its glyph line height to clear a 2 px margin, and the gap under the "Terminal" label lost two pixels. With a 12 px font that admits one more row. The Calendar widget got the same rule for consistency.
>
> **Nightscout widget.** IOB now follows the age line. Below that, only fields breaching the limits from Nightscout settings appear, inverted the way the app marks them: cannula age, reservoir volume, pump battery voltage, and loop age, one per line while room remains. Nothing shown means nothing is out of range. The strikethrough was already correct: the value is crossed at mid-height once the reading is older than the app's 15-minute limit, using the app's own helper. I added a comment saying so.
>
> Nothing is committed.
</details>
2026-09-11 16:56:55 -07:00
James Babcock a31ddae4d2 Merge branch 'main' into ios-port 2026-09-08 20:08:24 -07:00
James Babcock 070c891577 Enhancements to Nightscout and Terminal apps
Nightscout app: Alert thresholds for canula age, cartridge volume, pump
battery, time since last loop, shown in top bar. Option to always show
in top bar when window is closed.

Terminal app: Activity indicators in the app-switcher sidebar.
</details>
2026-09-08 13:58:47 -07:00
James Babcock e5ba7abc18 iOS porting: Battery indicators, app icon, add the rest of the apps 2026-09-07 10:18:30 -07:00
James Babcock 1524766996 Add screen-size setting to Navigate and Terminal apps 2026-09-05 10:45:39 -07:00
James Babcock 83c3732ba7 Swap app and system context menu gestures 2026-09-02 21:17:15 -07:00
James Babcock 987f442897 Context menus: gesture switch between app and system context menus; gesture help text; move items from app to system menu 2026-09-02 21:14:40 -07:00
James Babcock b1493a353d Context menus are centered and include window title 2026-09-01 00:58:28 -07:00
James Babcock 7ebf921299 Fix a race condition that sometimes caused apps to skip their first paint after launch 2026-08-30 15:35:19 -07:00
James Babcock 061b2eb215 Update the launcher, Files app and builtin games to better handle watch swipe gestures 2026-08-30 15:03:53 -07:00
James Babcock f6035ea9ec Performance optimizations 2026-08-20 02:46:03 -07:00
James Babcock 6df7e9bc81 Terminal connection string management, multi-host 2026-08-10 01:47:26 -07:00
James Babcock 7d2a41bd56 Apps are variable height; add vertical position setting 2026-07-31 14:52:51 -07:00
James Babcock b738ce4bb2 Add screen-recording option 2026-07-28 10:16:44 -07:00
James Babcock 434419c8e4 Add a minesweeper game, a freecell game, and some voice assistant tools for window management 2026-07-26 19:45:14 -07:00
James Babcock fe205c0164 Add app tool registration for voice assistant; voice assistant can read and send to terminals 2026-07-25 01:19:07 -07:00
James Babcock afc05d6a19 Redesign handling of long-press gesture and context menus 2026-07-22 22:45:14 -07:00
James Babcock 3452945322 Voice input suspends the screen-off timer; add menu to Nightscout; fix defocused highlight style in Terminal menu 2026-07-21 09:40:43 -07:00
James Babcock 1550c0ca32 Add support for voice-input refinement prompts, and other improvements to Temrinal 2026-07-14 15:57:14 -07:00
James Babcock 7ca3735c23 Add voice input support to terminal 2026-07-13 00:27:03 -07:00
James Babcock 22c779553c Sidebar uses icons for apps 2026-07-08 10:45:56 -07:00
James Babcock 5f82981b92 Continued UI redesign 2026-07-07 12:06:11 -07:00
James Babcock 68ab599856 Migrate things into new UI design 2026-07-07 00:52:47 -07:00
James Babcock 1133f952e9 App-switchign UI: Sidebar, top bar, launcher 2026-07-06 20:06:29 -07:00