forked from Blendman974/faceclaw
Short-then-long-press from off opens the glanceboard
This commit is contained in:
1 parent
25c398d60f
commit
bed21c9a5f
5 files changed
+10
-8
No files matched your search
@@ -6,6 +6,7 @@
|
||||
* Glanceboard tap setting includes a Disable option
|
||||
* Refinements to builtin games
|
||||
* Optimize bluetooth message transport
|
||||
* Short-the-long gesture from screen off activates the glanceboard
|
||||
|
||||
## 0.7.0 - 2026-09-12
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ export const glanceShowOnLongPressSetting = new ConfigSettingBoolean({
|
||||
label: "Show on long press",
|
||||
storageKey: "glanceboard.showOnLongPress",
|
||||
defaultValue: true,
|
||||
description: "Holding a long-press while asleep shows the Glanceboard until the press is released.",
|
||||
description: "A long-press or short-then-long-press while asleep shows the Glanceboard until the press is released.",
|
||||
});
|
||||
|
||||
/** The head-tilt wake shows the board (for the tap duration) instead of the regular UI. */
|
||||
|
||||
@@ -77,7 +77,7 @@ export class GlanceHost {
|
||||
const provider = this.options.getProvider();
|
||||
if (!provider?.isEnabled()) return null;
|
||||
if (gesture === "click" && !provider.showOnTap()) return null;
|
||||
if (gesture === "long-press" && !provider.showOnLongPress()) return null;
|
||||
if ((gesture === "long-press" || gesture === "short-then-long-press") && !provider.showOnLongPress()) return null;
|
||||
if (gesture === "head-tilt" && !provider.showOnHeadTilt()) return null;
|
||||
return glanceEventForGesture(gesture, this.isVisible());
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* The Glanceboard's visibility rules, as a pure reducer so they can be tested
|
||||
* without the display plumbing. The board is an alternate sleep-time display:
|
||||
* while the shell is asleep a press (single tap, or a head-tilt wake) shows it
|
||||
* for a short while, a hold (long-press) shows it until the press is released,
|
||||
* for a short while, a hold (long-press or short-then-long-press) shows it until release,
|
||||
* and a double-tap dismisses it in favour of the regular UI. GlanceHost feeds
|
||||
* these events in and applies the resulting visibility to the compositor.
|
||||
*
|
||||
@@ -49,8 +49,7 @@ export function reduceGlance(
|
||||
case "hold":
|
||||
return { visible: true, holding: true, hideAtMs: null };
|
||||
case "release":
|
||||
// Releases also follow presses the board was never holding for (a
|
||||
// tap-then-hold, a release delivered late); those mean nothing here.
|
||||
// Releases delivered late or after a disabled hold gesture mean nothing here.
|
||||
return state.holding ? GLANCE_HIDDEN : state;
|
||||
case "timeout":
|
||||
if (!state.visible || state.holding || state.hideAtMs === null || nowMs < state.hideAtMs) return state;
|
||||
@@ -67,7 +66,7 @@ export function reduceGlance(
|
||||
* already handles or ignores while asleep.
|
||||
*/
|
||||
export function glanceEventForGesture(
|
||||
gesture: "click" | "double-click" | "long-press" | "long-press-release" | "head-tilt" | string,
|
||||
gesture: "click" | "double-click" | "long-press" | "short-then-long-press" | "long-press-release" | "head-tilt" | string,
|
||||
boardVisible: boolean,
|
||||
): GlanceEvent | null {
|
||||
switch (gesture) {
|
||||
@@ -75,6 +74,7 @@ export function glanceEventForGesture(
|
||||
case "head-tilt":
|
||||
return { type: "press" };
|
||||
case "long-press":
|
||||
case "short-then-long-press":
|
||||
return { type: "hold" };
|
||||
case "long-press-release":
|
||||
return { type: "release" };
|
||||
|
||||
@@ -47,15 +47,16 @@ test("dismiss hides from any state", () => {
|
||||
assert.deepEqual(reduceGlance(shown, { type: "dismiss" }, T0), GLANCE_HIDDEN);
|
||||
});
|
||||
|
||||
test("gesture mapping: taps and head-tilt press, long-press holds, double-tap dismisses only a visible board", () => {
|
||||
test("gesture mapping: taps and head-tilt press, both long-press gestures hold, double-tap dismisses only a visible board", () => {
|
||||
assert.deepEqual(glanceEventForGesture("click", false), { type: "press" });
|
||||
assert.deepEqual(glanceEventForGesture("head-tilt", false), { type: "press" });
|
||||
assert.deepEqual(glanceEventForGesture("long-press", false), { type: "hold" });
|
||||
assert.deepEqual(glanceEventForGesture("short-then-long-press", false), { type: "hold" });
|
||||
assert.deepEqual(glanceEventForGesture("short-then-long-press", true), { type: "hold" });
|
||||
assert.deepEqual(glanceEventForGesture("long-press-release", true), { type: "release" });
|
||||
assert.equal(glanceEventForGesture("double-click", false), null);
|
||||
assert.deepEqual(glanceEventForGesture("double-click", true), { type: "dismiss" });
|
||||
assert.equal(glanceEventForGesture("scroll-up", true), null);
|
||||
assert.equal(glanceEventForGesture("short-then-long-press", true), null);
|
||||
});
|
||||
|
||||
test("the press timeout is the host's when supplied", () => {
|
||||
|
||||
Reference in new issue
Block a user