- C 92.4%
- JavaScript 6.1%
- Python 1.2%
- Makefile 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
* Replace custom HTML config with Clay settings UI - Add pebble-clay dependency and enableMultiJS: true - Add messageKeys array matching C code's integer constants (0-5) - New clay-config.js defines all settings as Clay components - pebble-js-app.js simplified: Clay handles showConfiguration and webviewclosed; ready handler sends Clay's stored settings to watch - Remove config-html.js (replaced by Clay) No C-side changes needed: Clay sends integer values at the same AppMessage keys (0=invert, 1=text_align, 2=lang, 3=font_size, 4=show_date, 5=date_timeout) that TextWatch.c already reads. https://claude.ai/code/session_014fTjHtCDhmfRoXR75ARG5y * Switch Clay dependency from pebble-clay to @rebble/clay https://claude.ai/code/session_014fTjHtCDhmfRoXR75ARG5y * Explicitly handle Clay showConfiguration and webviewclosed events Disable Clay's autoHandleEvents and wire up the events manually. This makes the config URL opening transparent and ensures it works correctly in the Rebble environment. https://claude.ai/code/session_014fTjHtCDhmfRoXR75ARG5y * Rename pebble-js-app.js to index.js (required entry point for enableMultiJS) The Pebble SDK with enableMultiJS: true expects src/pkjs/index.js as the entry point. pebble-js-app.js is removed — index.js replaces it. https://claude.ai/code/session_014fTjHtCDhmfRoXR75ARG5y * Remove pebble-js-app.js — replaced by index.js https://claude.ai/code/session_014fTjHtCDhmfRoXR75ARG5y * Remove config-html.js — replaced by Clay https://claude.ai/code/session_014fTjHtCDhmfRoXR75ARG5y * Add submit button to Clay config https://claude.ai/code/session_014fTjHtCDhmfRoXR75ARG5y * Add submit button to Clay config * Fix settings not applying: remove custom key mapping and ready handler - Remove toMessage() — Clay's getSettings() already returns messageKey-named values that Pebble's sendAppMessage resolves to the correct integer keys - Remove ready handler — it was sending Clay's localStorage defaults on every app launch, silently overwriting the watch's persisted settings with defaults - Guard webviewclosed against null e as well as missing e.response * Update README contributing guide for current architecture - Header template: use #define aliases for date_suffix instead of function declaration - Source template: remove date_suffix function body (covered by #define alias) - Note that no date_suffix function is needed when using the alias - Step 5: reference clay-config.js options array instead of pebble-js-app.js / config-html.js * Fix settings not updating watch and move save button to bottom - Explicitly convert Clay getSettings() values to integers before sendAppMessage: Clay decodes the URL response as strings, so passing them directly sends the wrong AppMessage type (string vs uint8). Use parseInt() for selects and ternary for toggles. - Move submit button to after language select so it appears at the bottom of the settings page. * Fix settings dropped due to AppSync outbox collision When the settings page closes, the watchface re-appears and window_load re-runs app_sync_init, which immediately sends the current values from the watch outbox to the phone. If sendAppMessage fires at the same moment the outbox is busy with that sync message, the phone's send is silently dropped. Fix: delay sendAppMessage by 200ms to let the watch's AppSync init message clear first. Also switch to explicit integer keys (0-5) to avoid any name-to-integer resolution step in the SDK. * Retry sendAppMessage on failure for real Bluetooth hardware The 200ms delay works on the emulator but real hardware has slower Bluetooth — the outbox is still busy when we send. Replace the one-shot send with a retry loop: up to 5 retries at 500ms intervals if the sendAppMessage error callback fires. * Fix AppMessage inbox too small for real hardware app_message_open(64, 64) is insufficient when the JS SDK sends integer values as INT32: 6 keys × 11 bytes/key + 1 byte header = 67 bytes, which exceeds the 64-byte inbox and causes the message to be silently dropped on real hardware (emulator is more lenient). Use app_message_inbox_size_maximum() / app_message_outbox_size_maximum() to allocate the full platform buffer instead. * Fix typo: fonts_unload_custom_font (not font_unload_custom_font) * Use named message keys on both sides so values map correctly The settings were landing on the wrong settings (e.g. selecting English GB turned the text French, alignment ignored, font wrong). Cause: the project defines messageKeys in package.json, so the Pebble JS SDK interprets the keys passed to sendAppMessage as named keys and remaps them through its own key table. Sending raw integer keys 0-5 therefore scrambled which value reached which setting. Fix: - C: define the *_KEY macros as the SDK-generated MESSAGE_KEY_<name> IDs instead of hardcoded 0-5, so AppSync registers/listens on the same IDs the SDK assigns. - JS: send by messageKey name (invert, text_align, lang, ...) instead of numeric keys, letting the SDK map names to those IDs. This guarantees both sides agree regardless of the build's key numbering. * Decouple persist keys from AppMessage keys for upgrade compatibility The AppMessage keys are now SDK-generated MESSAGE_KEY_* IDs, but earlier builds persisted settings under fixed integer keys 0-5. Reading/writing persistent storage under the new IDs would silently reset every user's saved settings on upgrade. Add separate PERSIST_* constants pinned to the original 0-5 values and use them for all persist_read/write calls, while the switch cases and AppSync Tuplets keep using the MESSAGE_KEY_* IDs for transport. Storage layout is now stable across versions, so upgrading users keep their settings. * Fix build: MESSAGE_KEY_* are not constant, can't be switch case labels The SDK-generated MESSAGE_KEY_<name> identifiers are link-time extern symbols, not compile-time integer constants, so using them as switch/case labels fails to compile ("case label does not reduce to an integer constant"). Convert sync_tuple_changed_callback's switch to an if/else-if chain comparing key against each MESSAGE_KEY_*. (The TupletInteger initial_values array is a local, runtime-initialised array, so the extern symbols are fine there.) * Replace AppSync with a plain inbox handler for settings AppSync keeps its own shadow copy and only fires per-key callbacks for values it considers changed; combined with Clay sending a full settings blob and SDK-assigned message key IDs, settings were unreliable (nothing applying, or font size stuck). Switch to the standard Clay pattern: register app_message_register_inbox_received and read each value directly with dict_find(MESSAGE_KEY_*). A tuple_int() helper reads the integer regardless of width/sign. All settings from one message are applied, then a single redraw/relayout happens at the end (font size triggers a full relayout; language/view changes a redraw). Removes AppSync state, init, deinit, and the initial_values Tuplet array. * Fix -Werror=sign-compare in tuple_int by casting ?: branches to int32_t The ternary's two branches (int32 vs uint32) differed in signedness, which -Werror=sign-compare rejects. Cast both branches to int32_t. * Pass clay.getSettings() straight to sendAppMessage (fixes NaN values) Phone logs showed "illegal float value nan for appmessage key 1000x" for all the select settings. Cause: clay.getSettings(response) already returns a dict keyed by message-key ID with converted values, ready to send. Our code instead read s.text_align / s.lang etc (which are undefined under those names) and parseInt'd them, producing NaN; the toggles read as 0. Fix: pass the getSettings() result directly to Pebble.sendAppMessage, as the Clay docs prescribe. Removes the manual remap, parseInt, and retry wrapper. * Fix crash: open AppMessage after window is pushed The inbox handler touches the text layers (display_time, text_layer_*), which are created in window_load. Registering the handler and opening AppMessage before window_stack_push meant a queued settings message could be delivered before the layers existed, dereferencing NULL and faulting at launch. Move app_message_register_inbox_received + app_message_open to after window_stack_push so window_load has run and the layers are valid. * Fix crash on save: parse string-typed setting tuples Clay's getSettings() returns select values as strings, so they arrive as TUPLE_CSTRING. tuple_int() was reading those bytes as a raw integer, turning "3" into ASCII 51. lang = 51 then indexed lang_strings[] far out of bounds in get_hour(), dereferencing a garbage pointer and faulting — which is why the watch crashed every time settings were saved. Make tuple_int() detect TUPLE_CSTRING and parse the decimal string, so "3" becomes 3. Integer tuples are still read at their actual width/sign. * Use lang_strings table for get_day/get_month Replace the hand-written day/month switch statements with table lookups, matching get_hour/get_rel. The lang_strings[] struct already carries days/months for every language, so behavior is unchanged. * Use lang_strings table for get_date_format Replace the last date switch statement with a table lookup, matching get_day/get_month/get_hour/get_rel. Behavior unchanged. * Update README for Clay settings and macro-driven language registration - Settings section notes the config page is built with Pebble Clay - Clarify that the ALL_LANGUAGES X-macro generates the enum, lang_strings[] table, and date-suffix dispatch, so no switch statements need editing * Bump version to 2.3.0 * Add a toggle to enable/disable animations - New 'animations' message key + PERSIST_ANIMATIONS (6) persisted setting - clay-config.js: 'Animations' toggle (default on) - When disabled, updateLineTo places the new line on-screen instantly instead of sliding, and pushes the old line off-screen - Loaded from persistent storage on launch like the other settings * Document the Animations setting and its battery benefit * Reword battery tip: disable animations and shake-to-date * Use hyphen instead of em-dash in battery tip --------- Co-authored-by: Claude <noreply@anthropic.com> |
||
| gfx | ||
| resources/fonts | ||
| src | ||
| .gitignore | ||
| LICENSE.md | ||
| makefile | ||
| package.json | ||
| pebble-jshintrc | ||
| README.md | ||
| wscript | ||
Fuzzy Text International 2
A watchface for Pebble that displays the time as natural language - "quarter past three", "half past ten" - in your choice of language and visual style.
Originally based on PebbleTextWatch by Mihai Dumitrache, with fuzzy time and Swedish support added by Mattias Bäcklund, and multi-language configuration by Jesse Hallett. This fork extends that work with additional languages, user experience improvements, and a cleaner architecture for contributors.
Features
- Fuzzy time in natural language across nine languages
- Large, easy-to-read fonts with smooth staggered animations
- Supports all Pebble models including higher resolution screens such as the Pebble Time 2
- Between one and four lines of text, adapting to what fits
- Shake to show the date, with a configurable auto-revert timeout
- Ordinal date suffixes for English (GB): 1st, 2nd, 3rd…
Settings
All settings are configurable from the watchface's settings page — built with Pebble Clay — in the Pebble app on your phone:
| Setting | Options |
|---|---|
| Invert colors | White-on-black / Black-on-white |
| Show date on shake | On / Off |
| Date view timeout | 3s / 5s / 8s / 60s / Never |
| Animations | On / Off |
| Text alignment | Center / Left / Right |
| Font size | Small / Medium / Large |
| Language | See below |
For the best battery life, turn Animations off and set Show date on shake to Off - this avoids the sliding redraws and keeps the accelerometer (shake detection) powered down.
Languages
- Català
- Deutsch
- English (Great Britain)
- English (United States)
- Español
- Français
- Nederlands (Nederland)
- Nederlands (België)
- Norsk
- Português
- Svenska
Contributing a Translation
To add a new language:
-
Create
src/c/strings-XX.h- declare the arrays and#defineany shared defaults:#pragma once #include "strings-en_US.h" #define DAYS_XX DAYS_EN_US #define MONTHS_XX MONTHS_EN_US #define DATE_FORMAT_XX "$1 $2 $3 " #define date_suffix_XX date_suffix_EN_US extern const char* const HOURS_XX[24]; extern const char* const RELS_XX[12];If your language uses its own day/month names, date order, or ordinal suffixes, define
DAYS_XX[7],MONTHS_XX[12], andDATE_FORMAT_XX[]as realchar[]arrays and write a realdate_suffix_XXfunction instead (seestrings-de.has an example). -
Create
src/c/strings-XX.c- define 24 hour names and 12 relative-time phrases:#include "strings-XX.h" const char* const HOURS_XX[] = { /* 12 AM + 12 PM hour names */ }; const char* const RELS_XX[] = { "*$1 ...", /* on the hour */ /* 11 more five-minute intervals */ };No
date_suffixfunction is needed if you used the#definealias in step 1. In theRELS_XXphrases,$1is replaced with the current hour and$2with the next. A*prefix makes that word bold. -
Register the language in
src/c/num2words.h- add one row toALL_LANGUAGESwith a unique integer value:X(XX, 0xN)This single line is all the wiring the C side needs: the
ALL_LANGUAGESX-macro generates theLanguageenum value, thelang_strings[]lookup table entry (hours, rels, days, months, date format), and theget_date_suffixdispatch. There are noswitchstatements to edit. -
Add the include in
src/c/num2words.c:#include "strings-XX.h" -
Add the language to
src/pkjs/clay-config.js- add an entry to the languageoptionsarray and keep it sorted alphabetically by label:{ "label": "Your Language", "value": N }
Please open an issue to report an error or discuss anything else. Pull requests are welcome.
Authors
- Mihai Dumitrache - original open-source Text Watch
- Mattias Bäcklund - Swedish fuzzy text watch
- Jesse Hallett - configuration options and multi-language support
- Adam Boutcher - this fork: additional languages, UX improvements, and contributor architecture
Contributors
- Filip Horvei - Norwegian translation
- Tomi De Lucca - iOS bug fix and Spanish translation assistance.
- nighto - Portuguese translation.
- Reiner Herrmann - Updates to include dates in the German Translation.
- optio - Dutch date names and Flemish translation.