Add experimental option to end EvenHub session when the screen is off for power saving

This commit is contained in:
James Babcock committed 2026-07-23 18:40:48 -07:00
1 parent 7455775390
commit e5649e9782
8 files changed
+315 -12

No files matched your search

+7
View File
@@ -248,6 +248,13 @@ export const firmwareDebugFlagsSetting = new ConfigSettingBoolean({
defaultValue: false,
});
export const suspendEvenHubWhenScreenOffSetting = new ConfigSettingBoolean({
id: "suspend-evenhub-screen-off",
label: "Suspend EvenHub when screen off",
storageKey: "developer.suspendEvenHubWhenScreenOff",
defaultValue: false,
});
export type VoiceProvider = "onboard" | "elevenlabs" | "whisper";
const voiceProviderLabels: Record<VoiceProvider, string> = {
+2
View File
@@ -11,6 +11,7 @@ import {
firmwareDebugFlagsSetting,
rawScreenshotsEnabledSetting,
saveVoiceRecordingsSetting,
suspendEvenHubWhenScreenOffSetting,
terminalAuthTokenSetting,
terminalHostSetting,
terminalPortSetting,
@@ -79,6 +80,7 @@ function settingsSections(): SettingsSection[] {
toggleSettingMenuItem(rawScreenshotsEnabledSetting),
toggleSettingMenuItem(saveVoiceRecordingsSetting),
toggleSettingMenuItem(firmwareDebugFlagsSetting),
toggleSettingMenuItem(suspendEvenHubWhenScreenOffSetting),
],
},
{
+5
View File
@@ -10,6 +10,11 @@ export type DashboardInputEvent =
| { type: "scroll-down" }
| { type: "long-press"; source: "ring" | "left-arm" | "right-arm" }
| { type: "long-press-release"; source: "ring" | "left-arm" | "right-arm" }
/**
* The stock display lifecycle woke while no EvenHub page was running. This
* is wake-only, unlike a normal double-click (which turns an on screen off).
*/
| { type: "display-wake" }
/**
* The on-glasses "Hey Even" wakeword fired. Delivered on sid 0x07 by the
* stock firmware regardless of CFW; the CFW additionally suppresses the stock
+14
View File
@@ -337,6 +337,14 @@ class Shell {
}
async receiveInput(event: DashboardInputEvent, frameId = 0): Promise<ShellInputOutcome> {
// The stock lifecycle has already interpreted the physical double tap as
// "wake". Keep that directionality if delivery is delayed or duplicated.
if (event.type === "display-wake") {
this.lastInputAtMs = Date.now();
const wokeScreen = !this.screenOn && this.wake("sidebar");
return { shell: wokeScreen, window: false };
}
// The wakeword is handled before the screen-off short-circuit so its
// configured action can work from a dark screen. With the CFW the stock
// Even AI app never launches, so the firmware does not power the display
@@ -609,6 +617,10 @@ export function rawInputEventToInputEvent(event: RawInputEvent): DashboardInputE
if (event.eventType === EvenAIStatus.EVEN_AI_WAKE_UP) {
return { type: "wakeword" };
}
} else if (event.kind === "display-wake") {
// Outside an EvenHub page the firmware consumes the physical double tap
// itself and reports only that the stock display lifecycle woke.
return { type: "display-wake" };
} else if (event.kind === "text-click") {
if (event.eventType === OsEventTypeList.SCROLL_BOTTOM_EVENT) {
return { type: "scroll-down" };
@@ -649,6 +661,8 @@ export function inputEventToString(event: DashboardInputEvent): string {
return `Long press from ${event.source}`;
case "long-press-release":
return `Long press release from ${event.source}`;
case "display-wake":
return `Display wake`;
case "wakeword":
return `Wakeword`;
default: