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
|
* Glanceboard tap setting includes a Disable option
|
||||||
* Refinements to builtin games
|
* Refinements to builtin games
|
||||||
* Optimize bluetooth message transport
|
* Optimize bluetooth message transport
|
||||||
|
* Short-the-long gesture from screen off activates the glanceboard
|
||||||
|
|
||||||
## 0.7.0 - 2026-09-12
|
## 0.7.0 - 2026-09-12
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export const glanceShowOnLongPressSetting = new ConfigSettingBoolean({
|
|||||||
label: "Show on long press",
|
label: "Show on long press",
|
||||||
storageKey: "glanceboard.showOnLongPress",
|
storageKey: "glanceboard.showOnLongPress",
|
||||||
defaultValue: true,
|
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. */
|
/** 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();
|
const provider = this.options.getProvider();
|
||||||
if (!provider?.isEnabled()) return null;
|
if (!provider?.isEnabled()) return null;
|
||||||
if (gesture === "click" && !provider.showOnTap()) 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;
|
if (gesture === "head-tilt" && !provider.showOnHeadTilt()) return null;
|
||||||
return glanceEventForGesture(gesture, this.isVisible());
|
return glanceEventForGesture(gesture, this.isVisible());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* The Glanceboard's visibility rules, as a pure reducer so they can be tested
|
* 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:
|
* 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
|
* 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
|
* 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.
|
* these events in and applies the resulting visibility to the compositor.
|
||||||
*
|
*
|
||||||
@@ -49,8 +49,7 @@ export function reduceGlance(
|
|||||||
case "hold":
|
case "hold":
|
||||||
return { visible: true, holding: true, hideAtMs: null };
|
return { visible: true, holding: true, hideAtMs: null };
|
||||||
case "release":
|
case "release":
|
||||||
// Releases also follow presses the board was never holding for (a
|
// Releases delivered late or after a disabled hold gesture mean nothing here.
|
||||||
// tap-then-hold, a release delivered late); those mean nothing here.
|
|
||||||
return state.holding ? GLANCE_HIDDEN : state;
|
return state.holding ? GLANCE_HIDDEN : state;
|
||||||
case "timeout":
|
case "timeout":
|
||||||
if (!state.visible || state.holding || state.hideAtMs === null || nowMs < state.hideAtMs) return state;
|
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.
|
* already handles or ignores while asleep.
|
||||||
*/
|
*/
|
||||||
export function glanceEventForGesture(
|
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,
|
boardVisible: boolean,
|
||||||
): GlanceEvent | null {
|
): GlanceEvent | null {
|
||||||
switch (gesture) {
|
switch (gesture) {
|
||||||
@@ -75,6 +74,7 @@ export function glanceEventForGesture(
|
|||||||
case "head-tilt":
|
case "head-tilt":
|
||||||
return { type: "press" };
|
return { type: "press" };
|
||||||
case "long-press":
|
case "long-press":
|
||||||
|
case "short-then-long-press":
|
||||||
return { type: "hold" };
|
return { type: "hold" };
|
||||||
case "long-press-release":
|
case "long-press-release":
|
||||||
return { type: "release" };
|
return { type: "release" };
|
||||||
|
|||||||
@@ -47,15 +47,16 @@ test("dismiss hides from any state", () => {
|
|||||||
assert.deepEqual(reduceGlance(shown, { type: "dismiss" }, T0), GLANCE_HIDDEN);
|
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("click", false), { type: "press" });
|
||||||
assert.deepEqual(glanceEventForGesture("head-tilt", false), { type: "press" });
|
assert.deepEqual(glanceEventForGesture("head-tilt", false), { type: "press" });
|
||||||
assert.deepEqual(glanceEventForGesture("long-press", false), { type: "hold" });
|
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.deepEqual(glanceEventForGesture("long-press-release", true), { type: "release" });
|
||||||
assert.equal(glanceEventForGesture("double-click", false), null);
|
assert.equal(glanceEventForGesture("double-click", false), null);
|
||||||
assert.deepEqual(glanceEventForGesture("double-click", true), { type: "dismiss" });
|
assert.deepEqual(glanceEventForGesture("double-click", true), { type: "dismiss" });
|
||||||
assert.equal(glanceEventForGesture("scroll-up", true), null);
|
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", () => {
|
test("the press timeout is the host's when supplied", () => {
|
||||||
|
|||||||
Reference in new issue
Block a user