Glanceboard: configurable head-tilt angle, glance down to hide

- Head tilt angle setting (Glanceboard): sets the glasses' own head-up
  trigger through the stock settings message (g2_setting.proto
  DeviceReceiveInfoFromAPP.deviceReceiveHeadUpSetting), so detection stays
  on the glasses and nothing streams while the screen is off. The stored
  calibration is read back and compensated for, and the value is
  re-applied on every connect. "glasses" (the default) leaves the
  glasses' setting untouched.
- "Set to current head angle" measures the tilt from a ~1.2 s IMU burst
  and rounds it to the nearest 5 degrees.
- Glance down to hide: a head-tilt showing now stays up until the head comes back down
  (HEAD_DOWN, forwarded by Faceclaw/38) instead of a fixed timeout, with
  a 60 s safety cap. HEAD_DOWN goes only to the Glanceboard on Android
  and iOS, so it never counts as shell activity.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BrendenandClaude Opus 5.5 committed 2026-11-06 08:58:33 -08:00
1 parent c896ce9ac8
commit cf74f34767
15 files changed
+536 -21

No files matched your search

+32 -1
View File
@@ -5,7 +5,8 @@ import { enumSettingMenuItem, onAnySettingChanged, toggleSettingMenuItem } from
import { uiFontOverridePickerMenuItem } from "../../ui/font-picker";
import { type InputEvent } from "../../ui/gestures";
import { type Layer, type LayerContext } from "../../ui/layers";
import { drawSelectionHighlight, isMenuItemDisabled, MenuLayer, openModalMenu, submenuItem, type MenuItem } from "../../ui/menu";
import { drawRightValueMenuItem, drawSelectionHighlight, isMenuItemDisabled, MenuLayer, openModalMenu, submenuItem, type MenuItem } from "../../ui/menu";
import { applyGlanceAngle, glassesHeadUpTrigger, setGlanceAngleFromHead } from "../../g2/head-angle";
import { Menu } from "../../ui/menu-core";
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../../ui/metrics";
import { createInProcessWindow, type InProcessAppOptions, type InProcessWindow } from "../../ui/shell/in-process-window";
@@ -19,6 +20,7 @@ import {
glanceLayout,
glanceLayoutSetting,
glanceShowLinesSetting,
glanceAngleSetting,
glanceShowOnHeadTiltSetting,
glanceShowOnLongPressSetting,
glanceSlotChoiceLabel,
@@ -312,6 +314,8 @@ function openGlanceSettings(ctx: LayerContext): void {
enumSettingMenuItem(glanceTapDurationSetting),
toggleSettingMenuItem(glanceShowOnLongPressSetting),
toggleSettingMenuItem(glanceShowOnHeadTiltSetting),
enumSettingMenuItem(glanceAngleSetting, { onChange: () => { applyGlanceAngle(); } }),
headAngleCaptureMenuItem(),
toggleSettingMenuItem(glanceShowLinesSetting),
uiFontOverridePickerMenuItem(glanceFont, {
title: "Glanceboard font",
@@ -325,6 +329,33 @@ function openGlanceSettings(ctx: LayerContext): void {
ctx.stack.push(layer);
}
/**
* "Set to current head angle": measure the head's tilt from the glasses'
* accelerometer, round it to the nearest 5°, store it as the Head tilt angle
* and send it to the glasses. The row's value shows the result, or the
* glasses' current trigger before the first use.
*/
let headAngleCaptureStatus = "";
function headAngleCaptureMenuItem(): MenuItem {
const label = "Set to current head angle";
return {
label,
description:
"Tilt your head to where the display should wake, keep still, and select. " +
"Faceclaw reads the glasses' angle for about a second, rounds it to the nearest 5°, and saves it as the Head tilt angle.",
onSelect: async () => {
headAngleCaptureStatus = "Measuring...";
headAngleCaptureStatus = await setGlanceAngleFromHead();
},
render: ({ image, x, y, width }) => {
const current = glassesHeadUpTrigger();
const value = headAngleCaptureStatus || (current === null ? "" : current === 0 ? "glasses: off" : `glasses: ${current}°`);
drawRightValueMenuItem(image, getDefaultSmallFont(), x, y, width, label, value);
},
};
}
/**
* One row per widget on the board, in slot order: a submenu of the widget's
* settings, or a disabled row for a widget that has none.
+28 -2
View File
@@ -73,7 +73,7 @@ export const glanceTapDurationSetting = new ConfigSettingEnum<GlanceTapDuration>
values: ["off", "3s", "5s", "7s", "10s"],
formatValue: (value) => (value === "off" ? "Disabled" : value.replace("s", " s")),
description:
"How long a single tap (or a head-tilt) keeps the Glanceboard on screen. Disabled: a single tap does not show the Glanceboard.",
"How long a single tap keeps the Glanceboard on screen. Disabled: a single tap does not show the Glanceboard.",
});
/** Whether a single tap while asleep shows the board. */
@@ -102,9 +102,35 @@ export const glanceShowOnHeadTiltSetting = new ConfigSettingBoolean({
label: "Show on head tilt",
storageKey: "glanceboard.showOnHeadTilt",
defaultValue: true,
description: "Tilting your head up while asleep shows the Glanceboard instead of waking the regular UI.",
description: "Tilting your head up while asleep shows the Glanceboard instead of waking the regular UI. It stays up until you look back down.",
});
const GLANCE_ANGLE_VALUES = ["glasses", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60"] as const;
export type GlanceAngle = (typeof GLANCE_ANGLE_VALUES)[number];
/**
* How far the head must tilt up for a head-tilt wake, as the glasses' own
* pitch reading (degrees). "glasses" leaves whatever the glasses already have
* (set by the Even app or its calibration). A number is written to the
* glasses' head-up setting on every connection (glasses-controls.ts).
*/
export const glanceAngleSetting = new ConfigSettingEnum<GlanceAngle>({
id: "glanceboard-head-tilt-angle",
label: "Head tilt angle",
storageKey: "glanceboard.headTiltAngle",
defaultValue: "glasses",
values: GLANCE_ANGLE_VALUES,
formatValue: (value) => (value === "glasses" ? "Glasses default" : `${value}°`),
description:
"How far you tilt your head up to wake the display. Glasses default keeps the angle already stored on the glasses.",
});
/** The trigger in degrees, or 0 when the glasses keep their own. */
export function glanceAngleDegrees(): number {
const value = glanceAngleSetting.get();
return value === "glasses" ? 0 : Number(value);
}
const DEPTH_VALUES = ["-64", "-48", "-32", "-16", "0", "16", "32", "48", "64"] as const;
export type GlanceDepth = (typeof DEPTH_VALUES)[number];