/everything-evenhub:handle-inputfrom everything-evenhub
Handles touchpad gestures, ring input, scroll, and lifecycle events in Even Hub G2 apps. Covers event routing rules for text and list containers, OsEventTypeList enum, and event models.
Ships in everything-evenhub. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Guide for handling user input, gestures, and lifecycle events in Even Hub G2 apps.
| Source | Gestures | Notes |
|---|---|---|
| G2 touchpads (temple) | Press, double press, swipe up, swipe down | Primary input |
| R1 touchpads (ring) | Press, double press, swipe up, swipe down | Optional accessory, same gesture set |
| IMU (accelerometer/gyroscope) | Head orientation, motion data | See device-features skill |
Events route differently depending on the active container type (the one with isEventCapture: 1). Only one container per page can capture events.
| Gesture | Event field | eventType |
|---|---|---|
| Swipe up | event.textEvent | 1 (SCROLL_TOP_EVENT) |
| Swipe down | event.textEvent | 2 (SCROLL_BOTTOM_EVENT) |
| Single press | event.sysEvent | undefined / 0 |
| Double press | event.sysEvent | 3 (DOUBLE_CLICK_EVENT) |
Key point: clicks and double-clicks on text containers fire as sysEvent, NOT textEvent. Only scroll gestures fire as textEvent.
| Gesture | Event field | Details |
|---|---|---|
| Swipe up/down | (internal) | SDK scrolls the list internally, no event fired |
| Single press | event.listEvent | .currentSelectItemIndex = selected item index |
| Double press | event.sysEvent | .eventType = 3 |
| Gesture | Event field | eventType |
|---|---|---|
| Foreground enter | event.sysEvent | 4 (FOREGROUND_ENTER_EVENT) |
| Foreground exit | event.sysEvent | 5 (FOREGROUND_EXIT_EVENT) |
| Abnormal exit | event.sysEvent | 6 (ABNORMAL_EXIT_EVENT) |
| System exit | event.sysEvent | 7 (SYSTEM_EXIT_EVENT) |
| Value | Name | Description |
|---|---|---|
| 0 | CLICK_EVENT | Single press (G2 or R1) |
| 1 | SCROLL_TOP_EVENT | Swipe up |
| 2 | SCROLL_BOTTOM_EVENT | Swipe down |
| 3 | DOUBLE_CLICK_EVENT | Double press (G2 or R1) |
| 4 | FOREGROUND_ENTER_EVENT | App comes to foreground |
| 5 | FOREGROUND_EXIT_EVENT | App goes to background |
| 6 | ABNORMAL_EXIT_EVENT | Unexpected disconnect |
| 7 | SYSTEM_EXIT_EVENT | System-level exit (e.g. user confirmed exit dialog) |
| 8 | IMU_DATA_REPORT | IMU data sample |
interface Text_ItemEvent {
containerID?: number
containerName?: string
eventType?: number // 1 = scroll up, 2 = scroll down
}
interface List_ItemEvent {
containerID?: number
containerName?: string
currentSelectItemName?: string
currentSelectItemIndex?: number // 0-based; undefined when 0 (protobuf)
eventType?: number
}
interface Sys_ItemEvent {
eventType?: number // undefined/0 = single click, 3 = double click
eventSource?: EventSourceType // 0=null, 1=glasses right, 2=ring, 3=glasses left
imuData?: IMU_Report_Data
systemExitReasonCode?: number
}
The SDK uses protobuf under the hood. Any field with a zero/default value (0, false, empty string) will be undefined, not the zero value. This affects:
sysEvent.eventType — single click is 0, but arrives as undefinedlistEvent.currentSelectItemIndex — first item is 0, but arrives as undefined0Always use nullish coalescing: event.sysEvent.eventType ?? 0, event.listEvent.currentSelectItemIndex ?? 0.
import { waitForEvenAppBridge } from '@evenrealities/even_hub_sdk'
const bridge = await waitForEvenAppBridge()
const unsubscribe = bridge.onEvenHubEvent(event => {
if (event.listEvent) {
// List item selected (single press on list container)
const idx = event.listEvent.currentSelectItemIndex ?? 0
console.log('Selected index:', idx)
return
}
if (event.textEvent) {
// Scroll on text container (NOT clicks — those come via sysEvent)
const type = event.textEvent.eventType ?? 0
if (type === 1) {
// Swipe up / scroll up
} else if (type === 2) {
// Swipe down / scroll down
}
return
}
if (event.sysEvent) {
const type = event.sysEvent.eventType ?? 0
if (type === 0) {
// Single press (on text container, or system-level)
} else if (type === 3) {
// Double press
} else if (type === 4) {
// App resumed (foreground enter)
} else if (type === 5) {
// App backgrounded (foreground exit)
}
return
}
})
// Always clean up on teardown
// unsubscribe()
G2 (temple touchpads) and R1 (ring touchpads) share the same gesture set. To distinguish between them, check eventSource in Sys_ItemEvent. The EventSourceType value indicates whether input came from the left arm, right arm, or ring accessory.
Every app should provide a way to exit via glasses/ring interaction. Use the SDK's built-in system exit dialog rather than building your own confirmation UI.
Canonical pattern — double-tap to show system exit dialog:
if (eventType === 3) { // DOUBLE_CLICK_EVENT
// Show the system exit dialog. Don't clean up resources here —
// the user can still cancel. If they confirm, the SDK fires
// SYSTEM_EXIT_EVENT (7) and you clean up in that handler.
bridge.shutDownPageContainer(1)
return
}
shutDownPageContainer modes:
shutDownPageContainer(0) — immediate exit, no confirmationshutDownPageContainer(1) — system exit confirmation dialog (recommended)Do not unsubscribe() / stop hardware / flush state before calling shutDownPageContainer(1). If you do and the user taps cancel, the app is still on screen but no longer listening for events. Clean up in the ABNORMAL_EXIT_EVENT / SYSTEM_EXIT_EVENT handlers instead.
Handle all four lifecycle events for a clean app:
| Event | When to use it |
|---|---|
FOREGROUND_ENTER_EVENT (4) | Re-render current state, resume timers/IMU |
FOREGROUND_EXIT_EVENT (5) | Flush pending state to setLocalStorage, pause timers |
ABNORMAL_EXIT_EVENT (6) | Stop hardware (imuControl(false), audioControl(false)), unsubscribe, flush state |
SYSTEM_EXIT_EVENT (7) | Same cleanup as ABNORMAL_EXIT — user confirmed exit from the system dialog |
sysEvent, not textEvent. Only scroll gestures fire textEvent. This is the most common source of event-handling bugs.bridge.onEvenHubEvent() returns an unsubscribe function. Always call it on component teardown.isEventCapture: 1 receives input events. If multiple containers have isEventCapture: 1, the SDK rejects the page with a validation error.$ARGUMENTS
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
touchpad-gestures, ring-input, event-routing, lifecycle-events
npx claudepluginhub even-realities/everything-evenhub --plugin everything-evenhub13 skills in this plugin
/background-stateImplement background state persistence for Even Hub G2 plugins — automatically analyzes existing plugin code, identifies state that needs to survive background/foreground transitions, and inserts setBackgroundState + onBackgroundRestore calls. Use when a plugin loses state after the phone goes to the background and returns./build-and-deployPackage and deploy an Even Hub G2 app — validate app.json, build, pack into .ehpk, upload it as a build, invite beta testers, and promote it to the beta channel. Use when packaging, deploying, uploading, distributing to testers, putting a build on beta, or submitting an Even Hub app./cli-referenceEven Hub CLI command reference — login, logout, self-check, init, pack, qr, create, upload, update, ls, promote, delist, testers, rm, download. Exit codes, --json output keys, and the checks that run locally before a request is sent. Use when running any CLI command, creating or uploading an app, managing beta testers and channels, or scripting the CLI in CI./design-guidelinesUI/UX design guidelines for Even Hub G2 smart glasses — display constraints, layout patterns, icon design, Unicode characters, and community resources. Use when designing glasses app interfaces or planning layouts./device-featuresUse G2 hardware features in Even Hub apps — microphone audio capture (glasses or phone mic), IMU motion data, location (one-shot and continuous), phone album picker / camera capture, device info, user info, and local storage. Use when working with audio, IMU, location, photos, battery, wearing detection, or persistent storage./font-measurementPixel-accurate font measurement for Even Realities G2 glasses — predict text layout dimensions matching the LVGL rendering engine. Use when sizing text containers precisely.Other plugins' skills for the same job