forked from Blendman974/faceclaw
Glanceboard: Head tilt timeout setting
How long a head-tilt showing may last when no head-down arrives: 60 s (the default, as before), 30, 15, 10 s, or never (it then stays until the head comes down or a double-tap). Where the head-down is unlikely, the tap duration still applies when it is shorter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b1ca8b8ca1
commit
58626ce146
8 files changed
+86
-25
No files matched your search
@@ -50,6 +50,8 @@ export type GlanceboardProvider = {
|
||||
showOnTap: () => boolean;
|
||||
/** How long a tap keeps the board up (and a head-tilt, when its head-down is unlikely to come). */
|
||||
tapTimeoutMs: () => number;
|
||||
/** How long a head-tilt showing may last without a head-down (null = no limit). */
|
||||
tiltTimeoutMs: () => number | null;
|
||||
/** Whether a long-press holds the board up until released. */
|
||||
showOnLongPress: () => boolean;
|
||||
/** Whether the head-tilt wake goes to the board rather than the regular UI. */
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
glanceShowLinesSetting,
|
||||
glanceAngleSetting,
|
||||
glanceShowOnHeadTiltSetting,
|
||||
glanceTiltTimeoutSetting,
|
||||
glanceShowOnLongPressSetting,
|
||||
glanceSlotChoiceLabel,
|
||||
glanceSlotSettings,
|
||||
@@ -322,6 +323,7 @@ function openGlanceSettings(ctx: LayerContext): void {
|
||||
enumSettingMenuItem(glanceTapDurationSetting),
|
||||
toggleSettingMenuItem(glanceShowOnLongPressSetting),
|
||||
toggleSettingMenuItem(glanceShowOnHeadTiltSetting),
|
||||
enumSettingMenuItem(glanceTiltTimeoutSetting),
|
||||
// Only Android can change the glasses' head-up setting (glasses-controls.ts).
|
||||
// The controller's settings listener sends a new angle to the glasses.
|
||||
...(headUpControlsAvailable() ? [enumSettingMenuItem(glanceAngleSetting), headAngleCaptureMenuItem()] : []),
|
||||
|
||||
@@ -107,6 +107,31 @@ export const glanceShowOnHeadTiltSetting = new ConfigSettingBoolean({
|
||||
description: "Tilting your head up while asleep shows the Glanceboard instead of waking the regular UI. It stays up until you look back down.",
|
||||
});
|
||||
|
||||
export type GlanceTiltTimeout = "60s" | "30s" | "15s" | "10s" | "never";
|
||||
|
||||
/**
|
||||
* How long a head-tilt showing may last if the head-down never comes (the
|
||||
* board normally hides when the head comes back down). "never" removes the
|
||||
* limit; a double-tap still dismisses the board.
|
||||
*/
|
||||
export const glanceTiltTimeoutSetting = new ConfigSettingEnum<GlanceTiltTimeout>({
|
||||
id: "glanceboard-head-tilt-timeout",
|
||||
label: "Head tilt timeout",
|
||||
storageKey: "glanceboard.headTiltTimeout",
|
||||
defaultValue: "60s",
|
||||
values: ["60s", "30s", "15s", "10s", "never"],
|
||||
formatValue: (value) => (value === "never" ? "Never" : value.replace("s", " s")),
|
||||
description:
|
||||
"The longest a head-tilt keeps the Glanceboard up when looking back down is not detected. Never: it stays until you look down or double-tap. " +
|
||||
"When looking down is unlikely to register (a low Head tilt angle, or the display was suspended), the tap duration applies if shorter.",
|
||||
});
|
||||
|
||||
/** The Head tilt timeout in ms, or null for none. */
|
||||
export function glanceTiltTimeoutMs(): number | null {
|
||||
const value = glanceTiltTimeoutSetting.get();
|
||||
return value === "never" ? null : Number.parseInt(value, 10) * 1000;
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
glanceShowOnLongPressSetting,
|
||||
glanceShowOnTap,
|
||||
glanceTapTimeoutMs,
|
||||
glanceTiltTimeoutMs,
|
||||
} from "./glanceboard-settings";
|
||||
|
||||
const glanceboardApp: AppDefinition = {
|
||||
@@ -24,6 +25,7 @@ const glanceboardApp: AppDefinition = {
|
||||
isEnabled: () => glanceboardEnabledSetting.get(),
|
||||
showOnTap: glanceShowOnTap,
|
||||
tapTimeoutMs: glanceTapTimeoutMs,
|
||||
tiltTimeoutMs: glanceTiltTimeoutMs,
|
||||
showOnLongPress: () => glanceShowOnLongPressSetting.get(),
|
||||
showOnHeadTilt: () => glanceShowOnHeadTiltSetting.get(),
|
||||
depth: glanceDepth,
|
||||
|
||||
Reference in new issue
Block a user