Swap app and system context menu gestures

This commit is contained in:
James Babcock committed 2026-09-02 21:17:15 -07:00
1 parent 987f442897
commit 83c3732ba7
23 files changed
+213 -153

No files matched your search

+2
View File
@@ -1,8 +1,10 @@
# Changelog # Changelog
## 0.6.5 - Future ## 0.6.5 - Future
* Changed context menu gestures: — for system, ●— for app context menu.
* System and app context menus show gesture help for switching to the other context menu * System and app context menus show gesture help for switching to the other context menu
* Move some items from app context menus to the system context menu * Move some items from app context menus to the system context menu
* Long-press now opens the system context menu and tap-then-hold the app context menu (games keep long-press as a move while playing)
## 0.6.4 - 2026-09-02 ## 0.6.4 - 2026-09-02
* Context menus are centered and include window title * Context menus are centered and include window title
+10 -6
View File
@@ -6,7 +6,7 @@
* Controls (in play): scroll moves the piece, click rotates, long-press hard * Controls (in play): scroll moves the piece, click rotates, long-press hard
* drops, double-click pauses. Watch swipes are spatial: left/right move, * drops, double-click pauses. Watch swipes are spatial: left/right move,
* up rotates, down hard-drops. Paused: click resumes, double-click yields * up rotates, down hard-drops. Paused: click resumes, double-click yields
* focus, long-press opens the window menu. * focus, tap-then-hold opens the window menu.
*/ */
import "@nativescript/core/globals"; import "@nativescript/core/globals";
import { GrayImage } from "../../graphics/image"; import { GrayImage } from "../../graphics/image";
@@ -143,7 +143,7 @@ type BlocksWindow = {
foreground: boolean; foreground: boolean;
/** Whether this window is the shell's input target (pushed with each message). */ /** Whether this window is the shell's input target (pushed with each message). */
focused: boolean; focused: boolean;
/** Long-press window menu; created on first open. */ /** Tap-then-hold window menu; created on first open. */
menu: WindowMenu | null; menu: WindowMenu | null;
phase: GamePhase; phase: GamePhase;
/** Locked cells; 0 = empty, otherwise the piece's shade byte. */ /** Locked cells; 0 = empty, otherwise the piece's shade byte. */
@@ -288,7 +288,7 @@ function playSfx(window: BlocksWindow, steps: Step[]): void {
} }
} }
/** The window's long-press menu (sound toggle); playing binds long-press to hard drop instead. */ /** The window's context menu (sound toggle), offered while paused or over; playing keeps long-press for hard drop. */
function windowMenuItems(window: BlocksWindow): MenuItem[] { function windowMenuItems(window: BlocksWindow): MenuItem[] {
return [ return [
{ {
@@ -308,8 +308,8 @@ function windowMenu(window: BlocksWindow): WindowMenu {
windowId: window.windowId, windowId: window.windowId,
post, post,
title: () => window.title, title: () => window.title,
items: () => windowMenuItems(window), items: () => (window.phase === "playing" ? [] : windowMenuItems(window)),
longPressOpensMenu: () => window.phase !== "playing", claimsLongPress: () => window.phase === "playing",
size: { width: window.viewportWidth, height: window.viewportHeight }, size: { width: window.viewportWidth, height: window.viewportHeight },
paintBase: () => paintContent(window), paintBase: () => paintContent(window),
isFocused: () => window.focused, isFocused: () => window.focused,
@@ -360,6 +360,10 @@ function handlePlayingInput(window: BlocksWindow, event: InputEvent, frameId: nu
case "long-press": case "long-press":
hardDrop(window); hardDrop(window);
break; break;
case "short-then-long-press":
// No context menu mid-game, so this opens the system menu instead.
windowMenu(window).open();
break;
case "double-click": case "double-click":
window.phase = "paused"; window.phase = "paused";
updateTickTimer(window); updateTickTimer(window);
@@ -385,7 +389,7 @@ function handleIdleInput(window: BlocksWindow, event: InputEvent, frameId: numbe
frameTimings.finishFrame(frameId, "discarded: blocks yielded focus"); frameTimings.finishFrame(frameId, "discarded: blocks yielded focus");
post({ type: "yield-focus", windowId: window.windowId }); post({ type: "yield-focus", windowId: window.windowId });
return; return;
case "long-press": case "short-then-long-press":
windowMenu(window).open(); windowMenu(window).open();
break; break;
default: default:
+1 -1
View File
@@ -1,5 +1,5 @@
/** /**
* Calculator window wiring: the in-process window, its long-press menu (mode * Calculator window wiring: the in-process window, its context menu (mode
* follow-ups, clear, settings), the assistant tools, and the voice/text * follow-ups, clear, settings), the assistant tools, and the voice/text
* plumbing into the layer. * plumbing into the layer.
* *
+13 -10
View File
@@ -35,10 +35,11 @@ class EvenHubAppLayer implements Layer {
} }
handleInput(event: InputEvent): void { handleInput(event: InputEvent): void {
// Everything goes to the app; long-press never reaches here (the window // Everything goes to the app; the menu gestures never reach here (the
// menu intercepts it), which is the guaranteed way out since EvenHub // shell keeps long-press for its system menu and the window's context
// apps own double-click. The press is still reported to the app as // menu intercepts tap-then-hold), which is the guaranteed way out since
// LONG_PRESS_EVENT — see the handleInput wrapper below. // EvenHub apps own double-click. Tap-then-hold is still reported to the
// app as LONG_PRESS_EVENT — see the handleInput wrapper below.
this.session.handleGesture(event); this.session.handleGesture(event);
} }
} }
@@ -62,7 +63,7 @@ export function createEvenHubWindow(
fallbackIcon, fallbackIcon,
), ),
heightMode: "medium", heightMode: "medium",
// The window's long-press menu doubles as the OS contextual menu EvenHub // The window's context menu doubles as the OS contextual menu EvenHub
// apps register with `menuObject` (SDK 0.0.14): the app's own entries come // apps register with `menuObject` (SDK 0.0.14): the app's own entries come
// first, then the host entries. Evaluated at open time, so a rebuild that // first, then the host entries. Evaluated at open time, so a rebuild that
// changes or clears the menu is reflected on the next press. // changes or clears the menu is reflected on the next press.
@@ -101,13 +102,15 @@ export function createEvenHubWindow(
windowId, windowId,
}); });
// LONG_PRESS_EVENT / LONG_PRESS_RELEASE_EVENT (SDK 0.0.14). Wrapped at the // LONG_PRESS_EVENT / LONG_PRESS_RELEASE_EVENT (SDK 0.0.14): the app hears
// window rather than handled in the base layer because the press opens the // the context-menu gesture (tap-then-hold; a plain long-press is the
// window menu and so never reaches a layer, and because the release lands on // shell's and never arrives) as its long-press. Wrapped at the window
// that menu once it is up. // rather than handled in the base layer because the press opens the window
// menu and so never reaches a layer, and because the release lands on that
// menu once it is up.
const baseHandleInput = created.window.handleInput; const baseHandleInput = created.window.handleInput;
created.window.handleInput = async (event, frameId) => { created.window.handleInput = async (event, frameId) => {
if (event.type === "long-press" || event.type === "long-press-release") { if (event.type === "short-then-long-press" || event.type === "long-press-release") {
session.handleGesture(event); session.handleGesture(event);
} }
await baseHandleInput(event, frameId); await baseHandleInput(event, frameId);
+9 -6
View File
@@ -447,13 +447,16 @@ export class EvenHubSession implements EvenHubMicClient, EvenHubImuClient, EvenH
this.emitSysEvent(DOUBLE_CLICK_EVENT, gestureSource(event.source)); this.emitSysEvent(DOUBLE_CLICK_EVENT, gestureSource(event.source));
break; break;
case "long-press": case "long-press":
case "short-then-long-press":
case "long-press-release": { case "long-press-release": {
// SDK 0.0.14 exposes press and release as ordinary events. The window // SDK 0.0.14 exposes press and release as ordinary events. The app's
// still opens its menu on the same gesture (that menu is where the // press is the context-menu gesture (tap-then-hold; the shell keeps
// app's contextual-menu items live, and it is the way out of an app // the plain long-press for its system menu): the window still opens
// that owns double-click), so an app hears the press as well as // its menu on it (that menu is where the app's contextual-menu items
// seeing the menu — it cannot be given exclusive use of the gesture. // live, and it is the way out of an app that owns double-click), so
const eventType = event.type === "long-press" ? LONG_PRESS_EVENT : LONG_PRESS_RELEASE_EVENT; // an app hears the press as well as seeing the menu — it cannot be
// given exclusive use of the gesture.
const eventType = event.type === "long-press-release" ? LONG_PRESS_RELEASE_EVENT : LONG_PRESS_EVENT;
if (capture?.kind === "list") { if (capture?.kind === "list") {
this.emitListEvent(capture, eventType); this.emitListEvent(capture, eventType);
} else { } else {
+5 -5
View File
@@ -8,7 +8,7 @@
* on a destination moves there; cascade-to-cascade moves take the longest * on a destination moves there; cascade-to-cascade moves take the longest
* legal run that fits (supermoves via empty cells/columns). Double-click * legal run that fits (supermoves via empty cells/columns). Double-click
* sends the card at the cursor to its foundation, or cancels a pending * sends the card at the cursor to its foundation, or cancels a pending
* selection. Long-press opens the window menu (undo, new game, restart). * selection. Tap-then-hold opens the window menu (undo, new game, restart).
* Watch swipes move the cursor spatially: left/right within the row, up/down * Watch swipes move the cursor spatially: left/right within the row, up/down
* between the top row (cells + foundations) and the cascades. * between the top row (cells + foundations) and the cascades.
* Safe cards auto-play to the foundations after every move. * Safe cards auto-play to the foundations after every move.
@@ -106,7 +106,7 @@ type FreecellWindow = {
foreground: boolean; foreground: boolean;
/** Whether this window is the shell's input target (pushed with each message). */ /** Whether this window is the shell's input target (pushed with each message). */
focused: boolean; focused: boolean;
/** Long-press window menu; created on first open. */ /** Tap-then-hold window menu; created on first open. */
menu: WindowMenu | null; menu: WindowMenu | null;
phase: "playing" | "won"; phase: "playing" | "won";
cascades: number[][]; cascades: number[][];
@@ -214,7 +214,7 @@ function playSfx(window: FreecellWindow, steps: Step[]): void {
} }
} }
/** The window's long-press menu (game actions). */ /** The window's context menu (game actions). */
function windowMenuItems(window: FreecellWindow): MenuItem[] { function windowMenuItems(window: FreecellWindow): MenuItem[] {
const items: MenuItem[] = []; const items: MenuItem[] = [];
if (window.undoStack.length > 0 && window.phase === "playing") { if (window.undoStack.length > 0 && window.phase === "playing") {
@@ -332,7 +332,7 @@ function handlePlayingInput(window: FreecellWindow, event: InputEvent, frameId:
sendToFoundation(window, window.cursor); sendToFoundation(window, window.cursor);
} }
break; break;
case "long-press": case "short-then-long-press":
windowMenu(window).open(); windowMenu(window).open();
break; break;
default: default:
@@ -352,7 +352,7 @@ function handleWonInput(window: FreecellWindow, event: InputEvent, frameId: numb
frameTimings.finishFrame(frameId, "discarded: freecell yielded focus"); frameTimings.finishFrame(frameId, "discarded: freecell yielded focus");
post({ type: "yield-focus", windowId: window.windowId }); post({ type: "yield-focus", windowId: window.windowId });
return; return;
case "long-press": case "short-then-long-press":
windowMenu(window).open(); windowMenu(window).open();
break; break;
default: default:
+1 -1
View File
@@ -169,7 +169,7 @@ class LauncherGridLayer implements Layer {
} }
/** /**
* App-specific entries for the window's long-press menu. Only item mode * App-specific entries for the window's context menu. Only item mode
* pins the selection to a single cell, and only apps can move to folders, * pins the selection to a single cell, and only apps can move to folders,
* so anywhere else the menu falls back to just the defaults. * so anywhere else the menu falls back to just the defaults.
*/ */
@@ -101,7 +101,7 @@ type MinesweeperWindow = {
foreground: boolean; foreground: boolean;
/** Whether this window is the shell's input target (pushed with each message). */ /** Whether this window is the shell's input target (pushed with each message). */
focused: boolean; focused: boolean;
/** Long-press window menu; created on first open. */ /** Tap-then-hold window menu; created on first open. */
menu: WindowMenu | null; menu: WindowMenu | null;
phase: GamePhase; phase: GamePhase;
difficultyIndex: number; difficultyIndex: number;
@@ -252,7 +252,7 @@ function playSfx(window: MinesweeperWindow, steps: Step[]): void {
} }
} }
/** The window's long-press menu (game actions); playing binds long-press to flagging instead. */ /** The window's context menu (game actions), offered while paused or over; playing keeps long-press for flagging. */
function windowMenuItems(window: MinesweeperWindow): MenuItem[] { function windowMenuItems(window: MinesweeperWindow): MenuItem[] {
const nextDifficulty = DIFFICULTIES[(window.difficultyIndex + 1) % DIFFICULTIES.length]!; const nextDifficulty = DIFFICULTIES[(window.difficultyIndex + 1) % DIFFICULTIES.length]!;
return [ return [
@@ -290,8 +290,8 @@ function windowMenu(window: MinesweeperWindow): WindowMenu {
windowId: window.windowId, windowId: window.windowId,
post, post,
title: () => window.title, title: () => window.title,
items: () => windowMenuItems(window), items: () => (window.phase === "playing" ? [] : windowMenuItems(window)),
longPressOpensMenu: () => window.phase !== "playing", claimsLongPress: () => window.phase === "playing",
size: { width: window.viewportWidth, height: window.viewportHeight }, size: { width: window.viewportWidth, height: window.viewportHeight },
paintBase: () => paintContent(window), paintBase: () => paintContent(window),
isFocused: () => window.focused, isFocused: () => window.focused,
@@ -366,6 +366,10 @@ function handlePlayingInput(window: MinesweeperWindow, event: InputEvent, frameI
} }
toggleFlag(window); toggleFlag(window);
break; break;
case "short-then-long-press":
// No context menu mid-game, so this opens the system menu instead.
windowMenu(window).open();
break;
case "double-click": case "double-click":
if (rowMode || watch) { if (rowMode || watch) {
window.phase = "paused"; window.phase = "paused";
@@ -398,7 +402,7 @@ function handleIdleInput(window: MinesweeperWindow, event: InputEvent, frameId:
frameTimings.finishFrame(frameId, "discarded: minesweeper yielded focus"); frameTimings.finishFrame(frameId, "discarded: minesweeper yielded focus");
post({ type: "yield-focus", windowId: window.windowId }); post({ type: "yield-focus", windowId: window.windowId });
return; return;
case "long-press": case "short-then-long-press":
windowMenu(window).open(); windowMenu(window).open();
break; break;
default: default:
+3 -3
View File
@@ -612,7 +612,7 @@ function describeRouteStatus(): string {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Input // Input
/** The window's long-press menu: only Stop navigation, and only while a route is up. */ /** The window's context menu: only Stop navigation, and only while a route is up. */
function windowMenuItems(win: NavWindow): MenuItem[] { function windowMenuItems(win: NavWindow): MenuItem[] {
if (phase !== "navigating" && phase !== "arrived") return []; if (phase !== "navigating" && phase !== "arrived") return [];
return [ return [
@@ -650,7 +650,7 @@ function handleInput(win: NavWindow, event: InputEvent, frameId: number): void {
.then(() => renderAndSubmit(win, frameId)); .then(() => renderAndSubmit(win, frameId));
return; return;
} }
if (event.type === "long-press") { if (event.type === "short-then-long-press") {
windowMenu(win).open(); windowMenu(win).open();
renderAndSubmit(win, frameId); renderAndSubmit(win, frameId);
return; return;
@@ -708,7 +708,7 @@ function paintIdle(image: GrayImage): void {
image.drawText(mediumFont, 24, 16, "Navigate", 245); image.drawText(mediumFont, 24, 16, "Navigate", 245);
const busy = phase !== "idle"; const busy = phase !== "idle";
const hint = isMapboxConfigured() const hint = isMapboxConfigured()
? "Ask the voice assistant to navigate somewhere, or pick Voice input from the system menu (tap, then hold) to say a destination." ? "Ask the voice assistant to navigate somewhere, or pick Voice input from the system menu (long-press) to say a destination."
: "Set a Mapbox token in Settings > API Keys to enable navigation."; : "Set a Mapbox token in Settings > API Keys to enable navigation.";
image.drawTextWrapped({ font: smallFont, x: 24, y: 64, width: image.width - 48, text: hint, value: 170 }); image.drawTextWrapped({ font: smallFont, x: 24, y: 64, width: image.width - 48, text: hint, value: 170 });
if (statusMessage) { if (statusMessage) {
+9 -5
View File
@@ -249,7 +249,7 @@ type PinballWindow = {
foreground: boolean; foreground: boolean;
/** Whether this window is the shell's input target (pushed with each message). */ /** Whether this window is the shell's input target (pushed with each message). */
focused: boolean; focused: boolean;
/** Long-press window menu; created on first open. */ /** Tap-then-hold window menu; created on first open. */
menu: WindowMenu | null; menu: WindowMenu | null;
phase: GamePhase; phase: GamePhase;
/** "ready" = parked on the plunger awaiting launch; "live" = in play. */ /** "ready" = parked on the plunger awaiting launch; "live" = in play. */
@@ -446,7 +446,7 @@ function playSfx(window: PinballWindow, steps: Step[], minor = false): void {
} }
} }
/** The window's long-press menu (game actions); playing binds long-press to the nudge instead. */ /** The window's context menu (game actions), offered while paused or over; playing keeps long-press for the nudge. */
function windowMenuItems(window: PinballWindow): MenuItem[] { function windowMenuItems(window: PinballWindow): MenuItem[] {
return [ return [
{ {
@@ -474,8 +474,8 @@ function windowMenu(window: PinballWindow): WindowMenu {
windowId: window.windowId, windowId: window.windowId,
post, post,
title: () => window.title, title: () => window.title,
items: () => windowMenuItems(window), items: () => (window.phase === "playing" ? [] : windowMenuItems(window)),
longPressOpensMenu: () => window.phase !== "playing", claimsLongPress: () => window.phase === "playing",
size: { width: window.viewportWidth, height: window.viewportHeight }, size: { width: window.viewportWidth, height: window.viewportHeight },
paintBase: () => paintContent(window), paintBase: () => paintContent(window),
isFocused: () => window.focused, isFocused: () => window.focused,
@@ -554,6 +554,10 @@ function handlePlayingInput(window: PinballWindow, event: InputEvent, frameId: n
} }
nudge(window); nudge(window);
break; break;
case "short-then-long-press":
// No context menu mid-game, so this opens the system menu instead.
windowMenu(window).open();
break;
case "double-click": case "double-click":
window.phase = "paused"; window.phase = "paused";
syncTickTimer(window); syncTickTimer(window);
@@ -580,7 +584,7 @@ function handleIdleInput(window: PinballWindow, event: InputEvent, frameId: numb
frameTimings.finishFrame(frameId, "discarded: pinball yielded focus"); frameTimings.finishFrame(frameId, "discarded: pinball yielded focus");
post({ type: "yield-focus", windowId: window.windowId }); post({ type: "yield-focus", windowId: window.windowId });
return; return;
case "long-press": case "short-then-long-press":
windowMenu(window).open(); windowMenu(window).open();
break; break;
default: default:
+1 -1
View File
@@ -104,7 +104,7 @@ async function roamPost(endpoint: "q" | "pull" | "write", body: object): Promise
const graph = roamGraphNameSetting.get(); const graph = roamGraphNameSetting.get();
const token = roamApiTokenSetting.get(); const token = roamApiTokenSetting.get();
if (!graph || !token) { if (!graph || !token) {
throw new Error("Set the Roam graph name and API token from the Roam app's long-press menu."); throw new Error("Set the Roam graph name and API token from the Roam app's context menu (tap, then hold).");
} }
const path = `/api/graph/${encodeURIComponent(graph)}/${endpoint}`; const path = `/api/graph/${encodeURIComponent(graph)}/${endpoint}`;
const payload = JSON.stringify(body); const payload = JSON.stringify(body);
+4 -4
View File
@@ -4,7 +4,7 @@
* todo or follows a [[page]] link, double-click walks back through visited * todo or follows a [[page]] link, double-click walks back through visited
* pages then yields focus. Edits (check/uncheck, add todo, edit block) go * pages then yields focus. Edits (check/uncheck, add todo, edit block) go
* through the Roam backend API and are also exposed as assistant tools. * through the Roam backend API and are also exposed as assistant tools.
* The graph name and API token are configured here too, from the long-press * The graph name and API token are configured here too, from the context
* menu, via the phone app's text editor. * menu, via the phone app's text editor.
*/ */
import "@nativescript/core/globals"; import "@nativescript/core/globals";
@@ -423,7 +423,7 @@ function handleInput(win: RoamWindow, event: InputEvent, frameId: number): void
} }
return; return;
} }
if (event.type === "long-press") { if (event.type === "short-then-long-press") {
windowMenu(win).open(); windowMenu(win).open();
renderAndSubmit(win, frameId); renderAndSubmit(win, frameId);
return; return;
@@ -525,7 +525,7 @@ async function addTodoFromText(text: string): Promise<void> {
async function handleRoamTool(name: string, args: any): Promise<ToolResult> { async function handleRoamTool(name: string, args: any): Promise<ToolResult> {
if (!isRoamConfigured()) { if (!isRoamConfigured()) {
return { ok: false, error: "Roam is not configured; set the graph name and API token from the Roam app's long-press menu." }; return { ok: false, error: "Roam is not configured; set the graph name and API token from the Roam app's context menu (tap, then hold)." };
} }
switch (name) { switch (name) {
case "read_page": { case "read_page": {
@@ -634,7 +634,7 @@ function paintContent(win: RoamWindow): GrayImage {
image.drawLine(DOC_MARGIN, HEADER_HEIGHT - 4, win.viewportWidth - DOC_MARGIN, HEADER_HEIGHT - 4, 40); image.drawLine(DOC_MARGIN, HEADER_HEIGHT - 4, win.viewportWidth - DOC_MARGIN, HEADER_HEIGHT - 4, 40);
if (!isRoamConfigured()) { if (!isRoamConfigured()) {
drawBodyMessage(image, win, "Set the Roam graph name and API token: long-press for the menu, then pick Set graph name and Set API token."); drawBodyMessage(image, win, "Set the Roam graph name and API token: tap, then hold, for the menu; pick Set graph name and Set API token.");
} else if (errorMessage) { } else if (errorMessage) {
drawBodyMessage(image, win, `${errorMessage}\n\n${GESTURE_CLICK} retry`); drawBodyMessage(image, win, `${errorMessage}\n\n${GESTURE_CLICK} retry`);
} else if (currentPage && currentPage.children.length === 0 && !loading) { } else if (currentPage && currentPage.children.length === 0 && !loading) {
+2 -2
View File
@@ -901,7 +901,7 @@ function reconnectView(window: ViewWindow): void {
scheduleRender(window); scheduleRender(window);
} }
/** The window's long-press menu, created lazily so window literals stay simple. */ /** The window's context menu, created lazily so window literals stay simple. */
function windowMenu(window: TerminalWindow): WindowMenu { function windowMenu(window: TerminalWindow): WindowMenu {
if (!window.menu) { if (!window.menu) {
window.menu = new WindowMenu({ window.menu = new WindowMenu({
@@ -1000,7 +1000,7 @@ function handleInput(window: TerminalWindow, event: InputEvent, frameId: number)
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
return; return;
} }
if (event.type === "long-press") { if (event.type === "short-then-long-press") {
windowMenu(window).open(); windowMenu(window).open();
renderAndSubmit(window, frameId); renderAndSubmit(window, frameId);
return; return;
+4 -4
View File
@@ -48,7 +48,7 @@ type TimerWindow = {
foreground: boolean; foreground: boolean;
/** Whether this window is the shell's input target (pushed with each message). */ /** Whether this window is the shell's input target (pushed with each message). */
focused: boolean; focused: boolean;
/** Long-press window menu; created on first open. */ /** Tap-then-hold window menu; created on first open. */
menu: WindowMenu | null; menu: WindowMenu | null;
view: TimerView; view: TimerView;
stopwatchAction: number; stopwatchAction: number;
@@ -295,8 +295,8 @@ function refreshWindowsAfterToolChange(): void {
} }
/** /**
* The window's long-press menu, created lazily. The timer has no entries of * The window's context menu, created lazily. The timer has no entries of
* its own, so a long-press opens the shell's system menu in its place. * its own, so tap-then-hold opens the shell's system menu in its place.
*/ */
function windowMenu(window: TimerWindow): WindowMenu { function windowMenu(window: TimerWindow): WindowMenu {
if (!window.menu) { if (!window.menu) {
@@ -322,7 +322,7 @@ function handleInput(window: TimerWindow, event: InputEvent, frameId: number): v
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
return; return;
} }
if (event.type === "long-press") { if (event.type === "short-then-long-press") {
windowMenu(window).open(); windowMenu(window).open();
renderAndSubmit(window, frameId); renderAndSubmit(window, frameId);
return; return;
+1 -1
View File
@@ -57,7 +57,7 @@ async function callAppTool(
args: unknown, args: unknown,
): Promise<ToolResult> { ): Promise<ToolResult> {
if (roamGraphNameSetting.get().length === 0 || roamApiTokenSetting.get().length === 0) { if (roamGraphNameSetting.get().length === 0 || roamApiTokenSetting.get().length === 0) {
return err("Roam is not configured; the user must set the graph name and API token from the Roam app's long-press menu."); return err("Roam is not configured; the user must set the graph name and API token from the Roam app's context menu (tap, then hold).");
} }
return callAppToolWithLaunch(registry, launchApp, "roam", unprefixedName, args); return callAppToolWithLaunch(registry, launchApp, "roam", unprefixedName, args);
} }
+3 -3
View File
@@ -25,7 +25,7 @@ export type InputEventPayload =
| { type: "scroll-down"; source?: InputSource } | { type: "scroll-down"; source?: InputSource }
| { type: "long-press"; source: InputSource } | { type: "long-press"; source: InputSource }
| { type: "long-press-release"; source: InputSource } | { type: "long-press-release"; source: InputSource }
/** G2 2.2.9 tap-then-hold gesture, reserved for the shell system menu. */ /** G2 2.2.9 tap-then-hold gesture: the app context-menu gesture (long-press is the system menu's). */
| { type: "short-then-long-press"; source: InputSource } | { type: "short-then-long-press"; source: InputSource }
/** /**
* Not a gesture: a shell -> foreground-window notification that the shell * Not a gesture: a shell -> foreground-window notification that the shell
@@ -114,8 +114,8 @@ export function directionalFallback(event: InputEvent): InputEvent {
* click ● (U+00B7 middle dot) * click ● (U+00B7 middle dot)
* double-click ●● (twice) * double-click ●● (twice)
* scroll ▲▼ (U+25B2 / U+25BC) * scroll ▲▼ (U+25B2 / U+25BC)
* long-press - (hyphen-minus) * long-press — (em dash)
* tap-then-hold ●- (click then long-press) * tap-then-hold ●— (click then long-press)
*/ */
export const GESTURE_CLICK = "\u25cf"; export const GESTURE_CLICK = "\u25cf";
export const GESTURE_DOUBLE_CLICK = GESTURE_CLICK+GESTURE_CLICK; export const GESTURE_DOUBLE_CLICK = GESTURE_CLICK+GESTURE_CLICK;
+10 -8
View File
@@ -31,11 +31,11 @@ export type InProcessWindowOptions = {
/** Window height: the standard 288px band ("min", default) or full screen ("max"). */ /** Window height: the standard 288px band ("min", default) or full screen ("max"). */
heightMode?: WindowHeightMode; heightMode?: WindowHeightMode;
/** /**
* The window's long-press context menu: app-specific entries only (the * The window's tap-then-hold context menu: app-specific entries only (the
* shared Focus app switcher / Voice input / Close window entries live in * shared Focus app switcher / Voice input / Close window entries live in
* the shell's system menu). Called at open time, so the items can reflect * the shell's system menu, on long-press). Called at open time, so the
* current app state. Omitted or empty means the window has no menu of its * items can reflect current app state. Omitted or empty means the window
* own, and a long-press opens the system menu instead. * has no menu of its own, and tap-then-hold opens the system menu instead.
*/ */
menuItems?: () => MenuItem[]; menuItems?: () => MenuItem[];
/** Shared actions; requestRender is rebound to this window's render. */ /** Shared actions; requestRender is rebound to this window's render. */
@@ -132,7 +132,7 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
const appMenuItems = () => options.menuItems?.() ?? []; const appMenuItems = () => options.menuItems?.() ?? [];
// The window's long-press menu: the app's own entries, or the shell's // The window's tap-then-hold menu: the app's own entries, or the shell's
// system menu when it has none (so both gestures land on the same menu). // system menu when it has none (so both gestures land on the same menu).
const openWindowMenu = () => { const openWindowMenu = () => {
if (stack.topMatches((layer) => layer instanceof WindowMenuLayer)) return; if (stack.topMatches((layer) => layer instanceof WindowMenuLayer)) return;
@@ -173,10 +173,12 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
} }
return; return;
} }
// The default long-press response: the window menu (or the system // The default tap-then-hold response: the window menu (or the system
// menu in its place). Handled here (not per-layer) so it works over // menu in its place). Handled here (not per-layer) so it works over
// submenus and app content alike. // submenus and app content alike. A plain long-press never arrives:
if (event.type === "long-press") { // the shell keeps it for the system menu (no in-process window claims
// it).
if (event.type === "short-then-long-press") {
openWindowMenu(); openWindowMenu();
await render(frameId); await render(frameId);
return; return;
+66 -40
View File
@@ -5,7 +5,7 @@ import { EvenAIStatus, EventSourceType, OsEventTypeList, WatchGestureType } from
import type { RawInputEvent } from "../../native/faceclaw-communicator"; import type { RawInputEvent } from "../../native/faceclaw-communicator";
import { import {
directionalFallback, directionalFallback,
GESTURE_LONG_PRESS, GESTURE_SHORT_THEN_LONG_PRESS,
gestureHints, gestureHints,
InputEvent, InputEvent,
type InputEventPayload, type InputEventPayload,
@@ -59,13 +59,14 @@ import {
* *
* Input flow: every event enters via receiveInput. The shell consumes * Input flow: every event enters via receiveInput. The shell consumes
* everything while the sidebar or a shell overlay has focus and forwards the * everything while the sidebar or a shell overlay has focus and forwards the
* rest to the focused window. Long-press goes to the foreground window (from * rest to the focused window. Long-press opens the shell-owned system menu
* the sidebar it focuses the window first); by convention apps answer it with * (Focus app switcher, Voice input, Close window, Debug) without reaching the
* app, so the shell keeps working when a window's handler hangs; a window
* that claims long-press for a move of its own gets it forwarded instead, and
* holding the press past the escape threshold still opens the system menu.
* The 2.2.9 tap-then-hold gesture goes to the foreground window (from the
* sidebar it focuses the window first); by convention apps answer it with
* their own context menu, or ask for the system menu when they have none. * their own context menu, or ask for the system menu when they have none.
* The system menu (Focus app switcher, Voice input, Close window, Debug) is
* shell-owned: the 2.2.9 tap-then-hold gesture opens it directly, and holding
* a long-press past the escape threshold opens it too, so the shell keeps
* working when a window's handler hangs.
*/ */
export type ShellWindow = { export type ShellWindow = {
@@ -77,12 +78,18 @@ export type ShellWindow = {
/** Whether the system menu offers Close window (the launcher is pinned). */ /** Whether the system menu offers Close window (the launcher is pinned). */
closeable: boolean; closeable: boolean;
/** /**
* True when a long-press currently opens the window's own context menu * True when tap-then-hold currently opens the window's own context menu
* (with at least one entry). While false, the system menu shows no * (with at least one entry). While false, the system menu shows no
* "long-press: app menu" hint and a long-press over the open system menu * app-menu hint and a tap-then-hold over the open system menu leaves it
* leaves it open instead of switching menus. * open instead of switching menus.
*/ */
hasAppMenu?: () => boolean; hasAppMenu?: () => boolean;
/**
* True while the window gives long-press a meaning of its own (a game
* move). The shell then forwards long-presses to it instead of opening the
* system menu; holding the press past the escape threshold still opens it.
*/
claimsLongPress?: () => boolean;
/** /**
* True when the window gives swipe-left / swipe-right (watch directional * True when the window gives swipe-left / swipe-right (watch directional
* input) a meaning; otherwise the shell forwards directionalFallback(event). * input) a meaning; otherwise the shell forwards directionalFallback(event).
@@ -171,9 +178,10 @@ export type FocusKind = "sidebar" | "window";
const noopActions: LayerActions = noopLayerActions; const noopActions: LayerActions = noopLayerActions;
/** /**
* Hold a long-press this much past the long-press event (which the firmware * For a window that claims long-press: hold the press this much past the
* itself only fires after a shorter hold) and the shell opens its own escape * long-press event (which the firmware itself only fires after a shorter
* menu — the recovery path when an app ignores or mishandles the gesture. * hold) and the shell opens the system menu anyway — the recovery path when
* the app ignores or mishandles the gesture.
*/ */
const LONG_PRESS_ESCAPE_MENU_MS = 4000; const LONG_PRESS_ESCAPE_MENU_MS = 4000;
@@ -652,28 +660,46 @@ class Shell {
return { shell: false, window: false }; return { shell: false, window: false };
} }
// The 2.2.9 tap-then-hold gesture is a direct, shell-owned escape hatch. // Long-press is the shell's own gesture: it opens the system menu
// Unlike an ordinary long-press it never reaches the app or starts the // directly, never reaching the app — over the app's own context menu
// fallback timer: it opens the same system menu that an extended hold // too (the window closes that on system-menu-opened), while an already
// would eventually open. Its later generic release is consumed while the // open system menu just stays. Its later generic release is consumed
// shell overlay is active and therefore cannot leak into the app. // while the shell overlay is active and therefore cannot leak into the
if (event.type === "short-then-long-press") { // app. The exception is a window that claims long-press for a move of
this.openEscapeMenu(); // its own: it gets the press forwarded, with the escape timer running
return { shell: true, window: false }; // so that holding the press long enough still opens the system menu.
if (event.type === "long-press") {
if (this.activeVoiceLayer || !this.stack.isAtBase()) {
return { shell: true, window: false };
}
const window = this.foregroundWindow();
if (!window) {
return { shell: true, window: false };
}
if (!window.claimsLongPress?.()) {
this.openEscapeMenu();
return { shell: true, window: false };
}
this.startEscapeMenuTimer();
if (this.focus === "sidebar") {
this.focus = "window";
window.onFocus?.(this.lastInput);
}
// The window owns frameId from here (render or explicit finish).
await window.handleInput(event, frameId);
return { shell: true, window: true };
} }
// Long-press goes to the foreground window (from the sidebar it focuses // The 2.2.9 tap-then-hold gesture is the app's context-menu gesture: it
// the window first); apps conventionally answer it with their context // goes to the foreground window (from the sidebar it focuses the window
// menu, or ask for the system menu when they have none. The escape timer // first), which answers with its own menu or asks for the system menu
// runs regardless of what the app does with it: holding the press long // when it has none.
// enough opens the shell's own menu. if (event.type === "short-then-long-press") {
if (event.type === "long-press") {
this.startEscapeMenuTimer();
const window = this.foregroundWindow(); const window = this.foregroundWindow();
// A long-press while the system menu is open switches to the app's // Over the open system menu it switches to the app's context menu:
// context menu: close the system menu and deliver the press to the // close the system menu and deliver the gesture to the window as
// window as usual. A window without a menu of its own would only ask // usual. A window without a menu of its own would only ask for the
// for the system menu back, so for it the open menu stays. // system menu back, so for it the open menu stays.
if ( if (
!this.activeVoiceLayer && !this.activeVoiceLayer &&
window?.hasAppMenu?.() && window?.hasAppMenu?.() &&
@@ -1184,7 +1210,7 @@ class Shell {
} }
/** /**
* A window's answer to a long-press when it has no context menu of its * A window's answer to tap-then-hold when it has no context menu of its
* own: open the system menu in its place, so both gestures land on the * own: open the system menu in its place, so both gestures land on the
* same menu. Ignored unless the window is still the foreground one. * same menu. Ignored unless the window is still the foreground one.
*/ */
@@ -1197,9 +1223,9 @@ class Shell {
* The system/escape menu: the entries every window shares (Focus app * The system/escape menu: the entries every window shares (Focus app
* switcher, Voice input, Close window) plus Debug. Shell-owned and * switcher, Voice input, Close window) plus Debug. Shell-owned and
* shell-drawn (never the app's), so an unresponsive app can always be * shell-drawn (never the app's), so an unresponsive app can always be
* closed. It opens for tap-then-hold, after an extended hold (over whatever * closed. It opens for long-press (over the app's own menu too), after an
* the app did with the ordinary long-press, including opening its own * extended hold in a window that claims long-press, and on a window's
* menu), and on a window's request when it has no menu of its own. * request when tap-then-hold finds it has no menu of its own.
*/ */
private openEscapeMenu(): void { private openEscapeMenu(): void {
if (!this.screenOn || this.activeVoiceLayer || !this.stack.isAtBase()) return; if (!this.screenOn || this.activeVoiceLayer || !this.stack.isAtBase()) return;
@@ -1249,11 +1275,11 @@ class Shell {
this.openToolDebugDialog(); this.openToolDebugDialog();
}, },
}); });
// Gesture help: a long-press switches to the app's own context menu, when // Gesture help: tap-then-hold switches to the app's own context menu,
// the app has one (otherwise it either does something app-specific or // when the app has one (otherwise it opens this very menu, not worth a
// opens this very menu, neither worth a hint). // hint).
const footer = foreground.hasAppMenu?.() const footer = foreground.hasAppMenu?.()
? gestureHints([[GESTURE_LONG_PRESS, "app menu"]]) ? gestureHints([[GESTURE_SHORT_THEN_LONG_PRESS, "app menu"]])
: undefined; : undefined;
layer = new ShellOverlayMenuLayer(items, footer, () => this.yieldFocusToSidebar()); layer = new ShellOverlayMenuLayer(items, footer, () => this.yieldFocusToSidebar());
layer.selectItem(initialSelection); layer.selectItem(initialSelection);
+19 -16
View File
@@ -73,7 +73,7 @@ export type WorkerAppReply =
} }
| { | {
/** /**
* The window's answer to a long-press when it has no context menu of * The window's answer to tap-then-hold when it has no context menu of
* its own: open the shell's system menu in its place. * its own: open the shell's system menu in its place.
*/ */
type: "open-system-menu"; type: "open-system-menu";
@@ -81,13 +81,16 @@ export type WorkerAppReply =
} }
| { | {
/** /**
* Whether a long-press currently opens the window's own context menu * The window's current gesture bindings, posted on change. hasAppMenu:
* (with something in it). Posted on change; the shell's system menu * tap-then-hold opens a context menu with something in it (the system
* shows its "long-press: app menu" hint only while this is true. * menu shows its app-menu hint only then). claimsLongPress: the app
* gives long-press a meaning of its own, so the shell forwards it
* rather than opening the system menu (see ShellWindow).
*/ */
type: "set-app-menu-available"; type: "set-window-gestures";
windowId: string; windowId: string;
available: boolean; hasAppMenu: boolean;
claimsLongPress: boolean;
} }
| { | {
/** Open or focus the Settings app, optionally jumping to a section. */ /** Open or focus the Settings app, optionally jumping to a section. */
@@ -190,8 +193,8 @@ const TOOL_CALL_HOST_TIMEOUT_MS = 15_000;
export class WorkerAppHost { export class WorkerAppHost {
private readonly openWindows = new Set<string>(); private readonly openWindows = new Set<string>();
/** Windows that reported a context menu of their own (see set-app-menu-available). */ /** Per-window gesture bindings, as last reported (see set-window-gestures). */
private readonly appMenuAvailable = new Set<string>(); private readonly windowGestures = new Map<string, { hasAppMenu: boolean; claimsLongPress: boolean }>();
private readonly pendingToolCalls = new Map<string, PendingToolCall>(); private readonly pendingToolCalls = new Map<string, PendingToolCall>();
private nextCallSerial = 1; private nextCallSerial = 1;
/** /**
@@ -266,12 +269,11 @@ export class WorkerAppHost {
shell.openSystemMenu(message.windowId); shell.openSystemMenu(message.windowId);
} }
break; break;
case "set-app-menu-available": case "set-window-gestures":
if (message.available) { this.windowGestures.set(message.windowId, {
this.appMenuAvailable.add(message.windowId); hasAppMenu: message.hasAppMenu,
} else { claimsLongPress: message.claimsLongPress,
this.appMenuAvailable.delete(message.windowId); });
}
break; break;
case "open-settings": case "open-settings":
this.options.openSettings(message.section); this.options.openSettings(message.section);
@@ -346,10 +348,11 @@ export class WorkerAppHost {
closeable: true, closeable: true,
acceptsDirectional: spec.acceptsDirectional, acceptsDirectional: spec.acceptsDirectional,
heightMode, heightMode,
hasAppMenu: () => this.appMenuAvailable.has(spec.windowId), hasAppMenu: () => this.windowGestures.get(spec.windowId)?.hasAppMenu ?? false,
claimsLongPress: () => this.windowGestures.get(spec.windowId)?.claimsLongPress ?? false,
close: () => { close: () => {
this.openWindows.delete(spec.windowId); this.openWindows.delete(spec.windowId);
this.appMenuAvailable.delete(spec.windowId); this.windowGestures.delete(spec.windowId);
// Withdraw this window's tools and fail any in-flight calls to it. // Withdraw this window's tools and fail any in-flight calls to it.
toolRegistry.removeAppTools(spec.windowId); toolRegistry.removeAppTools(spec.windowId);
this.failPendingToolCallsFor(spec.windowId); this.failPendingToolCallsFor(spec.windowId);
+37 -29
View File
@@ -1,19 +1,19 @@
import { GrayImage } from "../graphics/image"; import { GrayImage } from "../graphics/image";
import { singlePlane, type Plane } from "../graphics/plane"; import { singlePlane, type Plane } from "../graphics/plane";
import { GESTURE_SHORT_THEN_LONG_PRESS, gestureHints, type InputEvent } from "./gestures"; import { GESTURE_LONG_PRESS, gestureHints, type InputEvent } from "./gestures";
import { type Layer, LayerStack, noopLayerActions } from "./layers"; import { type Layer, LayerStack, noopLayerActions } from "./layers";
import { MenuLayer, type MenuItem, type MenuLayout } from "./menu"; import { MenuLayer, type MenuItem, type MenuLayout } from "./menu";
import type { WorkerAppReply } from "./shell/worker-window"; import type { WorkerAppReply } from "./shell/worker-window";
/** /**
* The window long-press menu: an app's own context menu, holding its * The window context menu, opened by tap-then-hold: an app's own menu,
* app-specific actions. The shell's system menu (tap-then-hold, or a press * holding its app-specific actions. The shell's system menu (long-press)
* held past the escape threshold) carries the entries every window shares — * carries the entries every window shares — Focus app switcher, Voice input,
* Focus app switcher, Voice input, Close window — so an app with nothing of * Close window — so an app with nothing of its own to offer has no menu of
* its own to offer has no menu of its own: a long-press then opens the system * its own: tap-then-hold then opens the system menu in its place, so both
* menu in its place, so both gestures land on the same menu. The system menu * gestures land on the same menu. The system menu is also the safety net:
* is also the safety net: shell-owned, so an unresponsive app can always be * shell-owned, so an unresponsive app can always be closed (a window that
* closed. * claims long-press for a move of its own reaches it by holding the press).
*/ */
/** Centered over the viewport; visually matches the shell's system menu position. */ /** Centered over the viewport; visually matches the shell's system menu position. */
@@ -22,7 +22,7 @@ export const WINDOW_MENU_LAYOUT: MenuLayout = {
y: 8, y: 8,
width: 272, width: 272,
minHeight: 150, minHeight: 150,
footer: gestureHints([[GESTURE_SHORT_THEN_LONG_PRESS, "system menu"]]), footer: gestureHints([[GESTURE_LONG_PRESS, "system menu"]]),
}; };
export class WindowMenuLayer extends MenuLayer { export class WindowMenuLayer extends MenuLayer {
@@ -38,16 +38,17 @@ export type WindowMenuOptions = {
title: () => string; title: () => string;
/** /**
* The app's menu entries, built at open time so they reflect current * The app's menu entries, built at open time so they reflect current
* state. Empty means the window has no context menu: open() asks the shell * state. Empty means the window has no context menu right now: open()
* for the system menu instead. * asks the shell for the system menu instead.
*/ */
items: () => MenuItem[]; items: () => MenuItem[];
/** /**
* False while the app gives long-press a meaning of its own (a game move) * True while the app gives long-press a meaning of its own (a game move).
* instead of opening this menu. Default: always true. Only informs the * The shell then forwards long-presses to the window instead of opening
* shell's system-menu hint; what a long-press does stays the app's call. * the system menu on them; holding the press past the escape threshold
* still reaches the system menu. Default: never.
*/ */
longPressOpensMenu?: () => boolean; claimsLongPress?: () => boolean;
/** Paint the window content the menu draws over (a fresh, mutable image). */ /** Paint the window content the menu draws over (a fresh, mutable image). */
paintBase: () => GrayImage; paintBase: () => GrayImage;
size: { width: number; height: number }; size: { width: number; height: number };
@@ -59,14 +60,15 @@ export type WindowMenuOptions = {
* a persistent LayerStack. Wraps a short-lived stack so MenuLayer (and the * a persistent LayerStack. Wraps a short-lived stack so MenuLayer (and the
* ctx.stack.pop() convention in item callbacks) works unchanged. * ctx.stack.pop() convention in item callbacks) works unchanged.
* *
* Usage: answer a long-press with open(); route input to handleInput while * Usage: answer tap-then-hold with open(); route input to handleInput while
* isOpen(); paint every frame through paint(), which returns the window * isOpen(); paint every frame through paint(), which returns the window
* content with the menu drawn over it and keeps the shell told whether the * content with the menu drawn over it and keeps the shell told about the
* window currently has a menu (the system menu's gesture hint depends on it). * window's gesture bindings (whether it has a menu, whether it claims
* long-press).
*/ */
export class WindowMenu { export class WindowMenu {
private stack: LayerStack | null = null; private stack: LayerStack | null = null;
private reportedAvailable: boolean | null = null; private reported: { hasAppMenu: boolean; claimsLongPress: boolean } | null = null;
constructor(private readonly options: WindowMenuOptions) {} constructor(private readonly options: WindowMenuOptions) {}
@@ -74,9 +76,9 @@ export class WindowMenu {
return this.stack !== null; return this.stack !== null;
} }
/** True when a long-press currently opens this menu with something in it. */ /** True when tap-then-hold currently opens this menu with something in it. */
isAvailable(): boolean { isAvailable(): boolean {
return (this.options.longPressOpensMenu?.() ?? true) && this.options.items().length > 0; return this.options.items().length > 0;
} }
/** /**
@@ -105,17 +107,23 @@ export class WindowMenu {
* ordinary frame has more planes than the menu needs beneath it. * ordinary frame has more planes than the menu needs beneath it.
*/ */
paint(content?: () => Plane[]): Plane[] { paint(content?: () => Plane[]): Plane[] {
this.syncAvailability(); this.syncGestures();
if (this.stack) return this.stack.paint(); if (this.stack) return this.stack.paint();
return content ? content() : singlePlane(this.options.paintBase()); return content ? content() : singlePlane(this.options.paintBase());
} }
/** Tell the shell when this window gains or loses its context menu. */ /** Tell the shell when this window's gesture bindings change. */
private syncAvailability(): void { private syncGestures(): void {
const available = this.isAvailable(); const hasAppMenu = this.isAvailable();
if (available === this.reportedAvailable) return; const claimsLongPress = this.options.claimsLongPress?.() ?? false;
this.reportedAvailable = available; if (this.reported?.hasAppMenu === hasAppMenu && this.reported.claimsLongPress === claimsLongPress) return;
this.options.post({ type: "set-app-menu-available", windowId: this.options.windowId, available }); this.reported = { hasAppMenu, claimsLongPress };
this.options.post({
type: "set-window-gestures",
windowId: this.options.windowId,
hasAppMenu,
claimsLongPress,
});
} }
/** Route an input event to the menu; the menu closes by popping itself. */ /** Route an input event to the menu; the menu closes by popping itself. */
+1 -1
View File
@@ -18,7 +18,7 @@ answered on `/faceclaw/ack`.
| Path | Payload | Effect | | Path | Payload | Effect |
| --- | --- | --- | | --- | --- | --- |
| `/faceclaw/input` | `{gesture, steps?}` | A ring gesture through the same path as the phone UI's test buttons. `gesture` ∈ `click`, `double-click`, `scroll-up`, `scroll-down`, `long-press` (complete short hold), `long-press-start`, `long-press-release`, `short-then-long-press` (tap then hold: the glasses' system menu), `wakeword` ("Hey Even"), `swipe-up`, `swipe-down`, `swipe-left`, `swipe-right` (spatial input only a watch can produce: delivered to the glasses UI as `swipe-*` events for components that navigate spatially — launcher grid, settings columns, sidebar, Music — with a scroll / click / double-click fallback elsewhere). `steps` (1–12) repeats a scroll. Refused while the glasses are disconnected. The lock screen is honoured exactly as for the ring. While the display is off, only a double-click is accepted and it wakes the display. | | `/faceclaw/input` | `{gesture, steps?}` | A ring gesture through the same path as the phone UI's test buttons. `gesture` ∈ `click`, `double-click`, `scroll-up`, `scroll-down`, `long-press` (complete short hold), `long-press-start`, `long-press-release`, `short-then-long-press` (tap then hold: the app's context menu; a plain `long-press` is the glasses' system menu), `wakeword` ("Hey Even"), `swipe-up`, `swipe-down`, `swipe-left`, `swipe-right` (spatial input only a watch can produce: delivered to the glasses UI as `swipe-*` events for components that navigate spatially — launcher grid, settings columns, sidebar, Music — with a scroll / click / double-click fallback elsewhere). `steps` (1–12) repeats a scroll. Refused while the glasses are disconnected. The lock screen is honoured exactly as for the ring. While the display is off, only a double-click is accepted and it wakes the display. |
| `/faceclaw/command` | `{command, …}` | `launch-app {appId}`, `focus-window {windowId}`, `close-window {windowId}`, `sidebar`, `wake`, `sleep`, `lock`, `unlock`, `connect`, `disconnect`, `close-assistant`, `display-mode {value}` (`value` ∈ `576x288`, `576x480`, `640x480`; sets the phone's Display > Display mode). Everything but connect/disconnect needs a connection; everything but lock/unlock is refused while locked; `unlock` also needs the phone's "Watch can unlock glasses" setting. | | `/faceclaw/command` | `{command, …}` | `launch-app {appId}`, `focus-window {windowId}`, `close-window {windowId}`, `sidebar`, `wake`, `sleep`, `lock`, `unlock`, `connect`, `disconnect`, `close-assistant`, `display-mode {value}` (`value` ∈ `576x288`, `576x480`, `640x480`; sets the phone's Display > Display mode). Everything but connect/disconnect needs a connection; everything but lock/unlock is refused while locked; `unlock` also needs the phone's "Watch can unlock glasses" setting. |
| `/faceclaw/assistant` | `{text}` | Send a query to the assistant (`shell.sendToAssistant`) — the reply shows on the glasses and streams back to the watch as events. | | `/faceclaw/assistant` | `{text}` | Send a query to the assistant (`shell.sendToAssistant`) — the reply shows on the glasses and streams back to the watch as events. |
| `/faceclaw/text` | `{text}` | Type text into the foreground window (`receiveTextInput`, e.g. the terminal). Refused when the window doesn't take text. | | `/faceclaw/text` | `{text}` | Type text into the foreground window (`receiveTextInput`, e.g. the terminal). Refused when the window doesn't take text. |
+2 -1
View File
@@ -13,7 +13,8 @@ the phone it only tells you to install it.
| --- | --- | | --- | --- |
| tap | select | | tap | select |
| double-tap, or a two-finger tap | **back**, everywhere: closes menus, leaves a settings column, leaves a folder or the launcher grid, returns to the sidebar (and from the sidebar turns the display off, as the ring does) | | double-tap, or a two-finger tap | **back**, everywhere: closes menus, leaves a settings column, leaves a folder or the launcher grid, returns to the sidebar (and from the sidebar turns the display off, as the ring does) |
| press and hold | the app's context menu (a long press, held until you lift your finger) | | press and hold | the system menu: Focus app switcher, Voice input, Close window (a long press, held until you lift your finger; games that use a long press as a move get it instead) |
| tap, then press and hold | the app's context menu |
| swipe ↑ ↓ ← → | **spatial navigation, with no mode to enter first**: the launcher highlights one app and the swipe moves it by a row or a column; the settings panel moves between its columns and down its lists; the sidebar moves up and down; Music skips to the previous / next track. Right goes *into* things (sidebar → window, section → items) and left comes back *out* (first column → sidebar). Anywhere without a spatial meaning, up/down scroll, right selects and left goes back. One step per swipe (long swipes used to repeat, which overshot lists whenever the display lagged); use repeated flicks, the crown, or a two-finger page swipe to cover distance. | | swipe ↑ ↓ ← → | **spatial navigation, with no mode to enter first**: the launcher highlights one app and the swipe moves it by a row or a column; the settings panel moves between its columns and down its lists; the sidebar moves up and down; Music skips to the previous / next track. Right goes *into* things (sidebar → window, section → items) and left comes back *out* (first column → sidebar). Anywhere without a spatial meaning, up/down scroll, right selects and left goes back. One step per swipe (long swipes used to repeat, which overshot lists whenever the display lagged); use repeated flicks, the crown, or a two-finger page swipe to cover distance. |
| rotate the crown | previous / next (one step per detent-ish, sensitivity adjustable) — clockwise is previous by default; reverse it in the on-glasses Settings > Watch section | | rotate the crown | previous / next (one step per detent-ish, sensitivity adjustable) — clockwise is previous by default; reverse it in the on-glasses Settings > Watch section |
| two-finger swipe up / down | scroll a page (3 steps) | | two-finger swipe up / down | scroll a page (3 steps) |
@@ -34,7 +34,7 @@ enum class Gesture(val wire: String) {
/** Finger down: the hold lasts until LONG_PRESS_RELEASE. */ /** Finger down: the hold lasts until LONG_PRESS_RELEASE. */
LONG_PRESS_START("long-press-start"), LONG_PRESS_START("long-press-start"),
LONG_PRESS_RELEASE("long-press-release"), LONG_PRESS_RELEASE("long-press-release"),
/** Tap then hold: opens the glasses' system menu (G2 2.2.9 gesture). */ /** Tap then hold: opens the app's context menu on the glasses (G2 2.2.9 gesture). */
SHORT_THEN_LONG_PRESS("short-then-long-press"), SHORT_THEN_LONG_PRESS("short-then-long-press"),
/** The spoken "Hey Even": opens the glasses' own voice dialog. */ /** The spoken "Hey Even": opens the glasses' own voice dialog. */
WAKEWORD("wakeword"), WAKEWORD("wakeword"),