Add tokens and faceclaw-input script, which allows using a CLI utility as an input device for the glasses

This commit is contained in:
James Babcock committed 2026-09-20 00:34:58 -07:00
1 parent 313ba85708
commit ccb320c66f
32 files changed
+1785 -12

No files matched your search

+10
View File
@@ -1,3 +1,4 @@
import { startRemoteInput } from "../remote/service";
import { acceptInput, resetRingInputFilter } from "../ui/input-monitor";
import { Application, ImageSource } from "@nativescript/core";
import { EvenAIStatus, EvenAIStatusName, EventSourceType, EventSourceTypeName, OsEventTypeList, OsEventTypeName, WatchGestureType, WatchGestureTypeName } from "./events";
@@ -404,6 +405,15 @@ class DashboardController {
this.syncAssistantBridge();
// The watch drives the same synthetic-input path as the phone UI's test
// buttons, plus app/window/lock commands; it mirrors the state below.
startRemoteInput({
ready: () => this.phase === "connected" || this.phase === "charging",
locked: () => this.glassesLocked,
input: (gesture, source) => this.injectSyntheticRingInput(gesture, source),
acceptsText: () => !!shell.foregroundWindow()?.receiveTextInput,
text: (text, submit) => { if (!shell.isScreenOn()) shell.wake("window"); shell.sendTextToForegroundWindow(text, { submit }); this.requestShellRender(); },
assistantAvailable: () => shell.isAssistantAvailable(),
assistant: text => shell.sendToAssistant(text),
});
this.wearRemote = new WearRemote({
apps: LAUNCHABLE_APPS,
injectInput: (kind) => this.injectSyntheticRingInput(kind, "watch"),
+18
View File
@@ -1,3 +1,4 @@
import { startRemoteInput } from "../remote/service"
import type { KeyboardInputSession } from '../ui/shell/keyboard-input'
import { acceptInput, resetRingInputFilter } from "../ui/input-monitor";
import { bindIosNotifications, iosNotificationsChanged, onIosNotificationPopup } from '../native/notification-icons.ios'
@@ -170,6 +171,23 @@ export class IosPreviewController {
shell.openNotificationModal(key, woke)
this.requestShellRender()
})
startRemoteInput({
ready: () => this.runtimeRunning,
locked: () => this.glassesLocked,
input: (gesture, source) => {
// Share the controller queue with physical input. A discrete hold includes its release.
const task = this.inputQueue.then(async () => {
await this.receiveInput(makeInputEvent({ type: gesture, source } as InputEventPayload))
if (gesture === 'long-press') await this.receiveInput(makeInputEvent({ type: 'long-press-release', source }))
})
this.inputQueue = task.catch(error => this.fail(error))
return task
},
acceptsText: () => !!shell.foregroundWindow()?.receiveTextInput,
text: (text, submit) => { if (!shell.isScreenOn()) shell.wake('window'); shell.sendTextToForegroundWindow(text, { submit }); this.requestShellRender() },
assistantAvailable: () => shell.isAssistantAvailable(),
assistant: text => shell.sendToAssistant(text),
})
registerSystemTools()
registerWindowTools({ apps: ALL_APPS.filter(app => !iosAppUnavailableReason(app.appId)),
launchApp: id => this.launchApp(id), requestShellRender: () => this.requestShellRender() })