Glassly Miniapp SDK betaThe SDK is in beta, so its APIs may change before general availability.Developing on Mentra Live? We recommend using the Glassly Bluetooth SDK.The developer tools are available in the Glassly App under Settings → Miniapp Developer Settings.Share feedback with an in-app bug report, on Discord, or by email at [email protected].
session.input delivers the physical controls on the glasses: button presses and touchpad gestures. The starter scaffold wires a button press to the display, so a short press shows a text wall.
src/background/index.ts
Button events only reach glasses that have a button. Declare a BUTTON hardware requirement in your manifest to gate the miniapp to those glasses.

Button presses

onButtonPress fires on every press of a physical button:
Each ButtonPressData has:

Keyboard

Even G2 glasses running Glassly CFW revision 39 or later can host a Bluetooth keyboard themselves (the user pairs it from the Glassly App under Controllers). onKey delivers every key transition to every subscribed miniapp, the same way button presses are broadcast:
Each KeyboardEventData has: A dropped link releases every held key with matching up events, so a modifier can never stay stuck. On glasses without a keyboard bridge the subscription never fires.

Touch gestures

onTouch subscribes to touchpad gestures. Pass a handler for every gesture, a single gesture name to filter, or an array of names for one subscription across several gestures.
Each TouchData has: The gesture values the runtime reports: Glasses can send other kind strings, so kind is typed as string. Match the values you handle and ignore the rest.

Claiming gestures

setClaimedGestures(gestures, {scope?}) registers the gestures your miniapp handles. Claims stack: the most recent registration receives the gesture alone, through onTouch, and the host skips its default behavior. This also applies to background miniapps. Subscribing with onTouch alone does not claim a gesture or override another miniapp’s claim.
Each call replaces the selected scope’s set; omitting scope uses the default scope. Re-registering a nonempty set takes priority again. Use separate scopes for persistent shortcuts and temporary pages so closing a page releases only its claims. Stopping the miniapp releases every scope. onClaimChange reports {gesture: string, held: boolean} to the miniapps gaining and losing a gesture; a handoff between two scopes of the same miniapp does not fire it. One host rule runs first: double-tap leaves a miniapp visibly drawing on the main view if that miniapp has not registered double_tap in any scope. Claim it if you use it while drawing there. Main content covered by a dashboard view is not visible, so the rule does not exit the miniapp underneath. A main miniapp that registered double-tap is not exited even if another claimant currently has priority.

Cleaning up

onButtonPress and every onTouch form return an unsubscribe function:
Calling onTouch with an array returns one unsubscribe function that drops all of the gestures it registered.