mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-29 13:03:11 +00:00
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:
1 parent
c896ce9ac8
commit
cf74f34767
15 files changed
+536
-21
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user