forked from Blendman974/faceclaw
[verified] merge upstream c162c8e6 into all-features
This commit is contained in:
commit
5790e98d27
176 files changed
+5311
-2307
No files matched your search
@@ -72,11 +72,11 @@ import {
|
||||
openAiTranscriptionModelSetting,
|
||||
previewColorSetting,
|
||||
previewScalingSetting,
|
||||
phoneInputStyleSetting,
|
||||
phoneRotationSetting,
|
||||
ringConnectionModeSetting,
|
||||
glassesTypeSetting,
|
||||
sonioxApiKeySetting,
|
||||
saveTranscribeAudioSetting,
|
||||
whisperServerApiKeySetting,
|
||||
whisperServerLanguageSetting,
|
||||
whisperServerModelSetting,
|
||||
@@ -87,7 +87,6 @@ import {
|
||||
lockScreenEnabledSetting,
|
||||
menuAnimationSetting,
|
||||
newNotificationDisplaySetting,
|
||||
saveVoiceRecordingsSetting,
|
||||
showBleBandwidthSetting,
|
||||
suspendEvenHubWhenScreenOffSetting,
|
||||
temperatureUnitSetting,
|
||||
@@ -149,8 +148,9 @@ function settingsSections(): SettingsSection[] {
|
||||
},
|
||||
{
|
||||
label: "Customization",
|
||||
// Depth only applies (and only shows) with the app switcher at the
|
||||
// bottom; the panel re-reads the rows each paint.
|
||||
// Depth, the status bar's place and the border only apply (and only
|
||||
// show) with the app switcher at the bottom or a popup; the panel
|
||||
// re-reads the rows each paint.
|
||||
get items() {
|
||||
return customizationItems();
|
||||
},
|
||||
@@ -245,6 +245,8 @@ function settingsSections(): SettingsSection[] {
|
||||
enumSettingMenuItem(previewColorSetting),
|
||||
enumSettingMenuItem(previewScalingSetting),
|
||||
toggleSettingMenuItem(mirrorTouchSetting),
|
||||
// Watch or Ring: which touchpad the main page shows under the mirror.
|
||||
enumSettingMenuItem(phoneInputStyleSetting),
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -270,7 +272,6 @@ function settingsSections(): SettingsSection[] {
|
||||
// Whether and how the phone opens its own BLE link to the R1 ring.
|
||||
// Applied at connect time.
|
||||
ringConnectionMenuItem(),
|
||||
toggleSettingMenuItem(saveVoiceRecordingsSetting),
|
||||
toggleSettingMenuItem(firmwareDebugFlagsSetting),
|
||||
toggleSettingMenuItem(suspendEvenHubWhenScreenOffSetting),
|
||||
toggleSettingMenuItem(useMicControlSetting),
|
||||
@@ -317,7 +318,7 @@ function settingsSections(): SettingsSection[] {
|
||||
toggleSettingMenuItem(showBleBandwidthSetting)] };
|
||||
// No downloadable on-device models: iOS's on-device option is Apple's recognizer.
|
||||
if (section.label === "Voice") return { label: "Voice", items: [enumSettingMenuItem(wakeWordActionSetting),
|
||||
enumSettingMenuItem(voiceProviderSetting), enumSettingMenuItem(voiceLanguageSetting), toggleSettingMenuItem(saveTranscribeAudioSetting), ...whisperServerMenuItems()] };
|
||||
enumSettingMenuItem(voiceProviderSetting), enumSettingMenuItem(voiceLanguageSetting), ...whisperServerMenuItems()] };
|
||||
if (section.label === "Display") return { ...section, items: section.items.filter(item =>
|
||||
item.label !== screenTimeoutSetting.label) };
|
||||
return section;
|
||||
@@ -342,9 +343,12 @@ function customizationRows(): () => MenuItem[] {
|
||||
// resizes or moves windows on change.
|
||||
const statusBar = enumSettingMenuItem(statusBarPositionSetting);
|
||||
// Popup switcher only: whether the status bar shows only in the switcher
|
||||
// (windows then grow into its rows), and the foreground window's border.
|
||||
// (windows then grow into its rows).
|
||||
const statusBarVisibility = enumSettingMenuItem(statusBarVisibilitySetting);
|
||||
const windowBorder = toggleSettingMenuItem(windowBorderSetting);
|
||||
// The lines round the foreground window: a rounded border all around, only
|
||||
// the line between it and the status bar, or none; the dashboard
|
||||
// controller resizes windows when the border's rows come or go.
|
||||
const windowBorder = enumSettingMenuItem(windowBorderSetting);
|
||||
const rest = [
|
||||
// Submenu: top-bar battery indicator style plus per-device visibility.
|
||||
batteryIndicatorsMenuItem(),
|
||||
@@ -357,7 +361,7 @@ function customizationRows(): () => MenuItem[] {
|
||||
// Miles or kilometers: Weather's wind speed and Navigate's distances.
|
||||
enumSettingMenuItem(distanceUnitSetting),
|
||||
];
|
||||
const bottomRows = [font, position, depth, statusBar, ...rest];
|
||||
const bottomRows = [font, position, depth, statusBar, windowBorder, ...rest];
|
||||
const popupRows = [font, position, depth, statusBar, statusBarVisibility, windowBorder, ...rest];
|
||||
const sideRows = [font, position, ...rest];
|
||||
return () => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { isMenuItemDisabled, MenuItem, MenuLayer, openModalMenu } from "../menu"
|
||||
import { Menu, drawMenuLabel } from "../menu-core";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../metrics";
|
||||
import { shell } from "../shell/shell";
|
||||
import type { Viewport } from "../viewport";
|
||||
|
||||
/**
|
||||
* One left-column entry. `items` are the right-column rows (reusing the shared
|
||||
@@ -29,8 +30,12 @@ export type SettingsSection = {
|
||||
}) => number | void;
|
||||
};
|
||||
|
||||
const PAD = 8;
|
||||
const LEFT_W = 150;
|
||||
/** Between the left column's rows and the divider, and between the divider and the right column's content. */
|
||||
const DIVIDER_GAP_LEFT = 8;
|
||||
const DIVIDER_GAP_RIGHT = 14;
|
||||
/** How far a right-column row's selection box overhangs the column's content on the left. */
|
||||
const RIGHT_ROW_OVERHANG = 2;
|
||||
/** Gap between a row's selection box and the next row. */
|
||||
const ROW_GAP = 2;
|
||||
/** Horizontal inset of row text (and custom row content) from its selection box. */
|
||||
@@ -116,27 +121,27 @@ export class SettingsPanelLayer implements Layer {
|
||||
|
||||
paint(ctx: LayerContext): GrayImage {
|
||||
const font = getDefaultSmallFont();
|
||||
const { width, height } = ctx.stack.getBaseSize();
|
||||
const viewport = ctx.stack.getBaseSize();
|
||||
const { width, height, padding } = viewport;
|
||||
const image = new GrayImage(width, height, 0);
|
||||
const appFocused = ctx.stack.isFocused();
|
||||
const section = this.section();
|
||||
const rightItems = section.items;
|
||||
this.rightMenu.setItems(rightItems);
|
||||
|
||||
const top = PAD;
|
||||
const listBottom = height - PAD;
|
||||
// Fixed content keeps the padding suggested for the window's edges. The
|
||||
// two lists scroll, so they run to the top and bottom edges themselves,
|
||||
// with that padding inside them (before the first row, after the last).
|
||||
const { top, bottom: listBottom, divX, rightX, rightW } = panelColumns(viewport);
|
||||
|
||||
// Left column: section labels.
|
||||
this.leftMenu.paint(image, { x: PAD - 2, y: top, width: LEFT_W, height: listBottom - top },
|
||||
this.leftMenu.paint(image, { x: padding.left, y: 0, width: LEFT_W, height, padTop: padding.top, padBottom: padding.bottom },
|
||||
appFocused && this.focus === "left");
|
||||
|
||||
// Column divider (a light rule, not a full border).
|
||||
const divX = PAD + LEFT_W + 6;
|
||||
image.drawLine(divX, top, divX, listBottom, 40);
|
||||
|
||||
// Right column: the highlighted section's contents.
|
||||
const rightX = divX + 14;
|
||||
const rightW = width - rightX - PAD;
|
||||
let rightTop = top;
|
||||
if (section.renderDetail && !this.detailCrowdsList(section, ctx, font, { x: rightX, y: top, width: rightW, height: listBottom - top })) {
|
||||
const used = section.renderDetail({ image, x: rightX, y: top, width: rightW, height: listBottom - top, ctx });
|
||||
@@ -146,12 +151,20 @@ export class SettingsPanelLayer implements Layer {
|
||||
// Once focus is in the right column, the selected item's extended
|
||||
// description (when it has one) is drawn over the bottom of the pane by
|
||||
// the companion SettingsDescriptionOverlayLayer. The list stops above
|
||||
// that band, so the selected row always stays clear of it.
|
||||
const listHeight = listBottom - this.descriptionHeight(font, rightW) - rightTop;
|
||||
if (listHeight > 0) {
|
||||
// that band, so the selected row always stays clear of it. Under a
|
||||
// detail, and above that band, the list ends short of the window's
|
||||
// edge, where it needs no padding of its own.
|
||||
const description = this.descriptionHeight(font, rightW);
|
||||
const fromEdge = rightTop === top;
|
||||
const listTop = fromEdge ? 0 : rightTop;
|
||||
const listEnd = description ? listBottom - description : height;
|
||||
if (listEnd > rightTop) {
|
||||
this.paintCtx = ctx;
|
||||
try {
|
||||
this.rightMenu.paint(image, { x: rightX - 2, y: rightTop, width: rightW + 2, height: listHeight }, appFocused);
|
||||
this.rightMenu.paint(image, {
|
||||
x: rightX - RIGHT_ROW_OVERHANG, y: listTop, width: rightW + RIGHT_ROW_OVERHANG, height: listEnd - listTop,
|
||||
padTop: fromEdge ? padding.top : 0, padBottom: description ? 0 : padding.bottom,
|
||||
}, appFocused);
|
||||
} finally {
|
||||
this.paintCtx = null;
|
||||
}
|
||||
@@ -204,10 +217,7 @@ export class SettingsPanelLayer implements Layer {
|
||||
*/
|
||||
paintDescriptionOverlay(image: GrayImage, ctx: LayerContext): void {
|
||||
const font = getDefaultSmallFont();
|
||||
const { width, height } = ctx.stack.getBaseSize();
|
||||
const listBottom = height - PAD;
|
||||
const rightX = PAD + LEFT_W + 6 + 14;
|
||||
const rightW = width - rightX - PAD;
|
||||
const { bottom: listBottom, rightX, rightW } = panelColumns(ctx.stack.getBaseSize());
|
||||
const lines = this.descriptionLines(font, rightW);
|
||||
if (!lines.length) return;
|
||||
const top = listBottom - (lines.length * lineStep(font) + 10);
|
||||
@@ -275,6 +285,19 @@ export class SettingsPanelLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The panel's fixed geometry in a viewport: the rows fixed content spans
|
||||
* (inside the padding suggested for the top and bottom edges), the divider's
|
||||
* x, and the right column's content span. The left column's rows start at
|
||||
* the left edge's padding; the right column ends at the right edge's.
|
||||
*/
|
||||
function panelColumns(viewport: Viewport): { top: number; bottom: number; divX: number; rightX: number; rightW: number } {
|
||||
const { width, height, padding } = viewport;
|
||||
const divX = padding.left + LEFT_W + DIVIDER_GAP_LEFT;
|
||||
const rightX = divX + DIVIDER_GAP_RIGHT;
|
||||
return { top: padding.top, bottom: height - padding.bottom, divX, rightX, rightW: width - rightX - padding.right };
|
||||
}
|
||||
|
||||
/** Scroll and watch swipe-up/down both move a column's selection. */
|
||||
function scrollEventFor(event: InputEvent): InputEvent | null {
|
||||
if (event.type === "scroll-up" || event.type === "swipe-up") return { ...event, type: "scroll-up" } as InputEvent;
|
||||
|
||||
Reference in new issue
Block a user