forked from Blendman974/faceclaw
Phone screen input shows gesture help for wake (and not random other gesture-help)
This commit is contained in:
1 parent
22c31f4240
commit
f01214f4a0
8 files changed
+73
-12
No files matched your search
@@ -93,7 +93,7 @@ import { createNotificationsAppWindow, NOTIFICATIONS_SURFACE_ID, NOTIFICATIONS_W
|
||||
import { isInstalledPackagePresent } from "../apps/evenhub/updates";
|
||||
import { wearerVerificationOptions } from "../apps/microphones/speakers";
|
||||
import { micSession } from "../apps/microphones/mic-session";
|
||||
import { glassesDisplayLabel } from "./glasses-display-state";
|
||||
import { glassesDisplayAsleep, glassesDisplayLabel, type GlassesDisplayState } from "./glasses-display-state";
|
||||
import { PreviewDisplayTarget, type DisplayTarget } from "../native/preview-display";
|
||||
|
||||
type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" | "disconnecting";
|
||||
@@ -1171,14 +1171,23 @@ class DashboardController {
|
||||
|
||||
/** What occupies the foreground-title line on the watch-style controls. */
|
||||
glassesDisplayLabel(): string {
|
||||
return glassesDisplayLabel({
|
||||
return glassesDisplayLabel(this.glassesDisplayState());
|
||||
}
|
||||
|
||||
/** Whether that line reads "Display off" (the watch face adds a wake hint under it). */
|
||||
glassesDisplayAsleep(): boolean {
|
||||
return glassesDisplayAsleep(this.glassesDisplayState());
|
||||
}
|
||||
|
||||
private glassesDisplayState(): GlassesDisplayState {
|
||||
return {
|
||||
phase: this.phase,
|
||||
silentMode: this.silentMode,
|
||||
screenOn: shell.isScreenOn(),
|
||||
battery: this.lastHeadsetBattery,
|
||||
foregroundTitle: shell.getForegroundApp()?.title ?? null,
|
||||
previewMode: this.isPreviewDisplayActive(),
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,12 +23,25 @@ export function glassesDisplayLabel(state: GlassesDisplayState): string {
|
||||
if (state.silentMode) {
|
||||
return "Silent mode";
|
||||
}
|
||||
if (!state.screenOn) {
|
||||
if (glassesDisplayAsleep(state)) {
|
||||
return "Display off";
|
||||
}
|
||||
return state.foregroundTitle || "Launcher";
|
||||
}
|
||||
|
||||
/**
|
||||
* True when the label reads "Display off": the screen is dark but the glasses
|
||||
* (or the preview standing in for them) would light it on a wake gesture.
|
||||
*/
|
||||
export function glassesDisplayAsleep(state: GlassesDisplayState): boolean {
|
||||
return (
|
||||
state.phase !== "charging" &&
|
||||
(state.phase === "connected" || state.previewMode) &&
|
||||
!state.silentMode &&
|
||||
!state.screenOn
|
||||
);
|
||||
}
|
||||
|
||||
export function chargingDisplayLabel(battery: number | null): string {
|
||||
return validBatteryLevel(battery) ? `Charging · G2 ${battery}%` : "Charging";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user