forked from Blendman974/faceclaw
Battery indicators and other places no longer say "G2" when a G1 or iO is paired
This commit is contained in:
1 parent
ac68ba5991
commit
e103b89510
21 files changed
+101
-46
No files matched your search
@@ -77,7 +77,7 @@ import { loadPersistedOpenApps, savePersistedOpenApps } from "../ui/shell/open-a
|
||||
import { appViewportRect, isOnSwitcherEdge, screenHeight, screenWidth, sidebarStripVisible, type ScreenRect, type WindowHeightMode } from "../ui/shell/geometry";
|
||||
import { type ContinuousCaptureOptions, type LayerActions, type TextSettingsEditToggle, type TranscriptionChoice } from "../ui/layers";
|
||||
import { type KeyboardInputSession } from "../ui/shell/keyboard-input";
|
||||
import { appSwitcherPositionSetting, glassesTypeSetting, statusBarPositionSetting, statusBarVisibilitySetting, windowBorderSetting, assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, getBrightnessPreferences, displayLayoutSetting, navigateDisplayLayoutSetting, terminalDisplayLayoutSetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, whisperServerApiKeySetting, whisperServerLanguageSetting, whisperServerModelSetting, whisperServerUrlSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, effectiveRingConnectionMode, type RingConnectionMode, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, shouldPopUpNewNotification, suspendEvenHubWhenScreenOffSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
|
||||
import { appSwitcherPositionSetting, glassesModelName, glassesTypeSetting, statusBarPositionSetting, statusBarVisibilitySetting, windowBorderSetting, assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, getBrightnessPreferences, displayLayoutSetting, navigateDisplayLayoutSetting, terminalDisplayLayoutSetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, whisperServerApiKeySetting, whisperServerLanguageSetting, whisperServerModelSetting, whisperServerUrlSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, effectiveRingConnectionMode, type RingConnectionMode, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, shouldPopUpNewNotification, suspendEvenHubWhenScreenOffSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
|
||||
import { isIgnoringBatteryOptimizations, requestIgnoreBatteryOptimizations } from "../native/battery-optimization";
|
||||
import {
|
||||
getInstalledEvenHubAppById,
|
||||
@@ -1267,6 +1267,7 @@ class DashboardController {
|
||||
silentMode: this.silentMode,
|
||||
screenOn: shell.isScreenOn(),
|
||||
battery: this.lastHeadsetBattery,
|
||||
glassesModel: glassesModelName(),
|
||||
caseBattery: batteries.case,
|
||||
caseCharging: batteries.caseCharging,
|
||||
foregroundTitle: shell.getForegroundApp()?.title ?? null,
|
||||
|
||||
@@ -3,6 +3,8 @@ export type GlassesDisplayState = {
|
||||
silentMode: boolean;
|
||||
screenOn: boolean;
|
||||
battery: number | null;
|
||||
/** The paired glasses' model, e.g. "G2" (glassesModelName). */
|
||||
glassesModel: string;
|
||||
/**
|
||||
* The charging case's last-known level, and whether it is on USB (null
|
||||
* while the glasses are out of the case). Shown only while charging, when
|
||||
@@ -20,7 +22,7 @@ export function glassesDisplayLabel(state: GlassesDisplayState): string {
|
||||
// Charging wins over every session-local state: the glasses are in their
|
||||
// case, so neither the lock screen nor the foreground window is visible.
|
||||
if (state.phase === "charging") {
|
||||
return chargingDisplayLabel(state.battery);
|
||||
return chargingDisplayLabel(state.battery, state.glassesModel);
|
||||
}
|
||||
// Preview mode has a live (simulated) screen despite the disconnected
|
||||
// phase, so fall through to the screen-state/foreground labels.
|
||||
@@ -63,8 +65,8 @@ export function glassesDisplayAsleep(state: GlassesDisplayState): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
export function chargingDisplayLabel(battery: number | null): string {
|
||||
return validBatteryLevel(battery) ? `Charging · G2 ${battery}%` : "Charging";
|
||||
export function chargingDisplayLabel(battery: number | null, glassesModel: string): string {
|
||||
return validBatteryLevel(battery) ? `Charging: ${glassesModel} ${battery}%` : "Charging";
|
||||
}
|
||||
|
||||
/** The shell's last-known battery levels (ShellChromeState["battery"]), as far as the phone shows them. */
|
||||
@@ -81,13 +83,13 @@ export type BatteryLevels = {
|
||||
* The phone Settings tab's battery row: each device whose level is known,
|
||||
* e.g. "G2 100% · Case 98% ⚡ · R1 72%" (⚡ = charging), or "" when none
|
||||
* is. Levels are the last known ones (the case only reports while the glasses
|
||||
* are docked), so ⚡ appears only while it is live: G2 and Case only with a
|
||||
* link to the glasses (`glassesLinked`: connected or charging), and Case only
|
||||
* while they are docked (caseCharging is null otherwise).
|
||||
* are docked), so ⚡ appears only while it is live: the glasses and Case only
|
||||
* with a link to the glasses (`glassesLinked`: connected or charging), and Case
|
||||
* only while they are docked (caseCharging is null otherwise).
|
||||
*/
|
||||
export function formatBatteryLine(levels: BatteryLevels, glassesLinked: boolean): string {
|
||||
export function formatBatteryLine(levels: BatteryLevels, glassesLinked: boolean, glassesModel: string): string {
|
||||
const devices: Array<[string, number | null, boolean | null]> = [
|
||||
["G2", levels.headset, glassesLinked && levels.headsetCharging],
|
||||
[glassesModel, levels.headset, glassesLinked && levels.headsetCharging],
|
||||
["Case", levels.case, glassesLinked && levels.caseCharging],
|
||||
["R1", levels.ring, levels.ringCharging],
|
||||
];
|
||||
|
||||
@@ -32,6 +32,7 @@ import { type AppDefinition } from "../apps/app-definition";
|
||||
import { getInstalledEvenHubApps, installedEvenHubAppId } from "../apps/evenhub/installed-apps";
|
||||
import { WEAR_PATHS, wearBridge, type WearMessage } from "../native/wear-bridge";
|
||||
import {
|
||||
glassesModelName,
|
||||
onAnySettingChanged,
|
||||
watchCanUnlockSetting,
|
||||
watchCrownClockwiseNextSetting,
|
||||
@@ -294,6 +295,7 @@ export class WearRemote {
|
||||
worn: state.glassesWorn,
|
||||
listening: voiceActivity.isActive(),
|
||||
battery: state.lastHeadsetBattery,
|
||||
glassesModel: glassesModelName(),
|
||||
charging: state.phase === "charging" || battery.headsetCharging === true,
|
||||
caseBattery: battery.case,
|
||||
caseCharging: battery.caseCharging,
|
||||
|
||||
Reference in new issue
Block a user