From 216dc59255178df6f49e26721f7b8486c8744a45 Mon Sep 17 00:00:00 2001 From: James Babcock Date: Mon, 31 Aug 2026 20:42:49 -0700 Subject: [PATCH] Add support for short-then-long gesture to watch input and simulated inputs --- CHANGELOG | 4 ++ app/g2/dashboard-controller.ts | 12 ++++++ app/g2/wear-remote.ts | 2 + app/phone-ui/main-view-model.ts | 39 ++++++++++++++++--- app/phone-ui/remote-controls.xml | 5 ++- wear/PROTOCOL.md | 2 +- .../main/kotlin/com/faceclaw/wear/Protocol.kt | 2 + .../com/faceclaw/wear/ui/RemoteScreen.kt | 3 ++ .../com/faceclaw/wear/ui/TouchpadGestures.kt | 38 +++++++++++++++--- 9 files changed, 93 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 63bf7943..eec5e8c6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Changelog +## 0.6.3 - Future +* Update custom firmware base version from 2.2.6 to 2.2.9 +* Add support for the short-then-long-press gesture + ## 0.6.2 - 2026-08-30 * Preview Only mode works * Voice input uses phone mic in preview mode diff --git a/app/g2/dashboard-controller.ts b/app/g2/dashboard-controller.ts index ab8117b8..218e2045 100644 --- a/app/g2/dashboard-controller.ts +++ b/app/g2/dashboard-controller.ts @@ -2494,6 +2494,7 @@ class DashboardController { | "scroll-down" | "long-press" | "long-press-release" + | "short-then-long-press" | "wakeword" | "swipe-left" | "swipe-right" @@ -2553,6 +2554,17 @@ class DashboardController { systemExitReasonCode: 0, frameId, }; + case "short-then-long-press": + // Discrete, unlike a hold: the firmware's later generic release is a + // hardware artifact the shell ignores, so synthetic sources send none. + return { + kind: "sys-event", + containerName: "", + eventType: OsEventTypeList.SHORT_THEN_LONG_PRESS_EVENT, + eventSource, + systemExitReasonCode: 0, + frameId, + }; case "click": return { kind: "sys-event", diff --git a/app/g2/wear-remote.ts b/app/g2/wear-remote.ts index d2b7f460..629d9d96 100644 --- a/app/g2/wear-remote.ts +++ b/app/g2/wear-remote.ts @@ -44,6 +44,7 @@ export type WearRemoteInputKind = | "long-press" | "long-press-start" | "long-press-release" + | "short-then-long-press" | "wakeword" | "swipe-left" | "swipe-right" @@ -58,6 +59,7 @@ const INPUT_KINDS: readonly WearRemoteInputKind[] = [ "long-press", "long-press-start", "long-press-release", + "short-then-long-press", "wakeword", "swipe-left", "swipe-right", diff --git a/app/phone-ui/main-view-model.ts b/app/phone-ui/main-view-model.ts index a854727f..fe027037 100644 --- a/app/phone-ui/main-view-model.ts +++ b/app/phone-ui/main-view-model.ts @@ -846,16 +846,36 @@ export class MainViewModel extends Observable { dashboardController.openEvenAppSettings(); } + // Tap-then-hold on the simulated pads: NativeScript reports doubleTap on + // the second finger-down and still runs the long-press recognizer on that + // same press, so the sequence arrives as doubleTap followed by longPress. + // Each pad therefore defers its double-click until the finger-up (the touch + // handler) and converts the deferred pair into the G2 tap-then-hold gesture + // when a longPress lands first. + + private ringPadDoubleTapPending = false; + async onRingPadTap(): Promise { await dashboardController.injectSyntheticRingInput("click"); } async onRingPadDoubleTap(): Promise { - await dashboardController.injectSyntheticRingInput("double-click"); + this.ringPadDoubleTapPending = true; } async onRingPadLongPress(): Promise { - await dashboardController.injectSyntheticRingInput("long-press"); + const kind = this.ringPadDoubleTapPending ? "short-then-long-press" : "long-press"; + this.ringPadDoubleTapPending = false; + await dashboardController.injectSyntheticRingInput(kind); + } + + async onRingPadTouch(args: TouchGestureEventData): Promise { + if (args.action !== "up" && args.action !== "cancel") return; + const pending = this.ringPadDoubleTapPending; + this.ringPadDoubleTapPending = false; + if (args.action === "up" && pending) { + await dashboardController.injectSyntheticRingInput("double-click"); + } } /** The ring pad only has a vertical axis, so left/right swipes are ignored. */ @@ -878,6 +898,9 @@ export class MainViewModel extends Observable { // above stays on the ring's own scheme. private padTwoFingerDown = false; + // See the ring pad above: defers the double-click so a longPress can turn + // the pair into tap-then-hold. + private padDoubleTapPending = false; /** What the next gesture lands on, as the watch pad shows it. */ get padFocusLine(): string { @@ -895,12 +918,13 @@ export class MainViewModel extends Observable { } async onPadDoubleTap(): Promise { - await dashboardController.injectSyntheticRingInput("double-click", "watch"); - this.refreshPadFocusLine(); + this.padDoubleTapPending = true; } async onPadLongPress(): Promise { - await dashboardController.injectSyntheticRingInput("long-press", "watch"); + const kind = this.padDoubleTapPending ? "short-then-long-press" : "long-press"; + this.padDoubleTapPending = false; + await dashboardController.injectSyntheticRingInput(kind, "watch"); this.refreshPadFocusLine(); } @@ -917,6 +941,8 @@ export class MainViewModel extends Observable { return; } if (args.action === "up" || args.action === "cancel") { + const pendingDouble = this.padDoubleTapPending; + this.padDoubleTapPending = false; const twoFinger = this.padTwoFingerDown; if (twoFinger) { // Let the single-tap recognizer's delayed tap see the flag first. @@ -927,6 +953,9 @@ export class MainViewModel extends Observable { await dashboardController.injectSyntheticRingInput("double-click", "watch"); this.refreshPadFocusLine(); } + } else if (args.action === "up" && pendingDouble) { + await dashboardController.injectSyntheticRingInput("double-click", "watch"); + this.refreshPadFocusLine(); } } } diff --git a/app/phone-ui/remote-controls.xml b/app/phone-ui/remote-controls.xml index 276df11a..ff41d8ef 100644 --- a/app/phone-ui/remote-controls.xml +++ b/app/phone-ui/remote-controls.xml @@ -4,7 +4,7 @@ scheme as the watch pad - tap = select, double-tap or two fingers = back, hold = menu, swipes navigate), and Ring (a touchpad on the ring's own scheme: vertical swipes scroll, tap/double-tap/hold = click/double-click/ - long-press). The narrow mic button at the tab bar's right edge fires the + long-press). Tap-then-hold on either pad is the G2 system-menu gesture. The narrow mic button at the tab bar's right edge fires the wakeword without changing the selected tab. Used by main-page.xml in both orientations; binds to the page's MainViewModel, which collapses the whole area while a text setting is being edited (keyboard-input mode). @@ -63,7 +63,8 @@ rows="*,auto,*,auto,*,auto,*,auto,*,auto,*,auto,*" horizontalAlignment="center" verticalAlignment="center" tap="{{ onRingPadTap }}" doubleTap="{{ onRingPadDoubleTap }}" - longPress="{{ onRingPadLongPress }}" swipe="{{ onRingPadSwipe }}"> + longPress="{{ onRingPadLongPress }}" swipe="{{ onRingPadSwipe }}" + touch="{{ onRingPadTouch }}">