forked from Blendman974/faceclaw
Move Terminal and Navigate settings out of the Settings app and into their respective apps
This commit is contained in:
1 parent
4bc3551135
commit
2ff764d6ea
11 files changed
+114
-72
No files matched your search
@@ -45,16 +45,9 @@ import {
|
||||
ringBatteryVisibilitySetting,
|
||||
watchBatteryVisibilitySetting,
|
||||
displayModeSetting,
|
||||
navigateDisplayModeSetting,
|
||||
navigateVerticalPositionSetting,
|
||||
terminalDisplayModeSetting,
|
||||
terminalVerticalPositionSetting,
|
||||
elevenLabsApiKeySetting,
|
||||
mapboxApiKeySetting,
|
||||
mirrorTouchSetting,
|
||||
navigateHomeAddressSetting,
|
||||
navigateRememberRecentSetting,
|
||||
navigateWorkAddressSetting,
|
||||
openAiApiKeySetting,
|
||||
previewColorSetting,
|
||||
phoneRotationSetting,
|
||||
@@ -68,9 +61,6 @@ import {
|
||||
saveVoiceRecordingsSetting,
|
||||
showBleBandwidthSetting,
|
||||
suspendEvenHubWhenScreenOffSetting,
|
||||
terminalAutoReconnectSetting,
|
||||
terminalLaunchPresetsSetting,
|
||||
terminalWakeOnBellSetting,
|
||||
textSettingMenuItem,
|
||||
timeFormatSetting,
|
||||
toggleSettingMenuItem,
|
||||
@@ -84,10 +74,9 @@ import {
|
||||
watchMirrorAssistantSetting,
|
||||
watchRemoteEnabledSetting,
|
||||
} from "../dashboard-settings";
|
||||
import { clearRecentDestinations } from "../../apps/navigate/destinations";
|
||||
import { wearBridge } from "../../native/wear-bridge";
|
||||
import { openSettingsSubMenu, SettingsPanelLayer, type SettingsSection } from "./settings-panel";
|
||||
import { terminalFontPickerMenuItem, uiFontPickerMenuItem } from "../font-picker";
|
||||
import { uiFontPickerMenuItem } from "../font-picker";
|
||||
|
||||
/** The Settings app's master-detail panel (sections on the left, contents on the right). */
|
||||
export function createSettingsPanelLayer(): SettingsPanelLayer {
|
||||
@@ -114,6 +103,11 @@ function settingsSections(): SettingsSection[] {
|
||||
enumSettingMenuItem(verticalPositionSetting),
|
||||
// Band / tall / full-panel; the dashboard controller reflows windows.
|
||||
enumSettingMenuItem(displayModeSetting),
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Customization",
|
||||
items: [
|
||||
// Submenu: top-bar battery indicator style plus per-device visibility.
|
||||
batteryIndicatorsMenuItem(),
|
||||
// Submenu: toggles for menu/icon-grid motion and the screen on/off fade.
|
||||
@@ -161,35 +155,6 @@ function settingsSections(): SettingsSection[] {
|
||||
textSettingMenuItem(mapboxApiKeySetting),
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Terminal",
|
||||
// Connections (g2mirror:// strings) are managed inside the Terminal
|
||||
// app's Manage Connections section, not here.
|
||||
items: [
|
||||
enumSettingMenuItem(terminalDisplayModeSetting),
|
||||
enumSettingMenuItem(terminalVerticalPositionSetting),
|
||||
terminalFontPickerMenuItem(),
|
||||
textSettingMenuItem(terminalLaunchPresetsSetting),
|
||||
toggleSettingMenuItem(terminalAutoReconnectSetting),
|
||||
toggleSettingMenuItem(terminalWakeOnBellSetting),
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Navigate",
|
||||
// Home/Work are plain addresses; other named destinations (and the
|
||||
// recent list) are managed inside the Navigate app's context menu.
|
||||
items: [
|
||||
enumSettingMenuItem(navigateDisplayModeSetting),
|
||||
enumSettingMenuItem(navigateVerticalPositionSetting),
|
||||
textSettingMenuItem(navigateHomeAddressSetting),
|
||||
textSettingMenuItem(navigateWorkAddressSetting),
|
||||
toggleSettingMenuItem(navigateRememberRecentSetting, {
|
||||
onChange: (_ctx, enabled) => {
|
||||
if (!enabled) clearRecentDestinations();
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Phone display",
|
||||
// The phone app's mirror of the glasses screen and its controls
|
||||
@@ -284,7 +249,7 @@ function autoBrightnessMenuItem(): MenuItem {
|
||||
}
|
||||
|
||||
/**
|
||||
* The Display section's "Battery indicators" row: opens a modal submenu with
|
||||
* The Customization section's "Battery indicators" row: opens a modal submenu with
|
||||
* the style (icon / percentage / stacked) and, per device, when its
|
||||
* indicator is visible. The row itself shows the current style.
|
||||
*/
|
||||
@@ -316,7 +281,7 @@ function batteryIndicatorsMenuItem(): MenuItem {
|
||||
};
|
||||
}
|
||||
|
||||
/** The Display section's "Animations" row: opens a modal submenu of animation toggles. */
|
||||
/** The Customization section's "Animations" row: opens a modal submenu of animation toggles. */
|
||||
function animationsMenuItem(): MenuItem {
|
||||
return {
|
||||
label: "Animations",
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
/**
|
||||
* Modal font picker for the Settings app: choose a face (bitmap Terminus
|
||||
* Modal font picker for font settings: choose a face (bitmap Terminus
|
||||
* variants or any installed TTF family), a weight (the family's installed
|
||||
* styles), and a pixel size, with a live preview line rendered in the draft
|
||||
* font. Selections only persist on Save; double-click cancels.
|
||||
*
|
||||
* Used for the UI font (Display section), the terminal font (Terminal
|
||||
* section, filtered to monospace faces), and per-app overrides of the UI font
|
||||
* (UiFontOverride, which add an "inherit" face ahead of the others).
|
||||
* Used for the UI font (Settings > Customization), the terminal font (the
|
||||
* Terminal app's settings, filtered to monospace faces), and per-app
|
||||
* overrides of the UI font (UiFontOverride, which add an "inherit" face
|
||||
* ahead of the others).
|
||||
*/
|
||||
import { getFont } from "../graphics/bdffont";
|
||||
import { GrayImage, type UiFont } from "../graphics/image";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Whether menus and icon grids animate on the glasses (Settings > Display >
|
||||
* Whether menus and icon grids animate on the glasses (Settings > Customization >
|
||||
* Animations > Menu animation). The motion classes can't read the settings
|
||||
* store themselves (it is native, and they load under Node in unit tests),
|
||||
* so ui/menu.ts installs a reader in each isolate that paints menus. Without
|
||||
|
||||
@@ -377,7 +377,7 @@ export class ShellChromeLayer implements Layer {
|
||||
* Labelled battery indicators for the phone, Wear OS watch, G2, and R1,
|
||||
* right-aligned in the top bar. The watch one exists only while a watch
|
||||
* running the Faceclaw watch app is reachable (no placeholder otherwise).
|
||||
* The Settings > Display > Battery indicators submenu picks the style (label beside a gauge icon or percentage, or stacked above
|
||||
* The Settings > Customization > Battery indicators submenu picks the style (label beside a gauge icon or percentage, or stacked above
|
||||
* either) and, per device, whether the indicator shows always, only below
|
||||
* 50%, or never. Returns the left edge of the battery block.
|
||||
*/
|
||||
|
||||
+37
-4
@@ -1,7 +1,7 @@
|
||||
import { GrayImage } from "../graphics/image";
|
||||
import { singlePlane, type Plane } from "../graphics/plane";
|
||||
import { GESTURE_LONG_PRESS, GESTURE_SHORT_THEN_LONG_PRESS, gestureHints, type InputEvent } from "./gestures";
|
||||
import { type Layer, LayerStack, noopLayerActions } from "./layers";
|
||||
import { type Layer, type LayerActions, LayerStack, noopLayerActions } from "./layers";
|
||||
import { CONTEXT_MENU_DIM, MenuLayer, type MenuItem, type MenuLayout } from "./menu";
|
||||
import type { WorkerAppReply } from "./shell/worker-window";
|
||||
|
||||
@@ -69,10 +69,16 @@ export type WindowMenuOptions = {
|
||||
* content with the menu drawn over it and keeps the shell told about the
|
||||
* window's gesture bindings (whether it has a menu, whether it claims
|
||||
* long-press).
|
||||
*
|
||||
* Text-setting rows (textSettingMenuItem) work here too: the phone editor
|
||||
* opens through the shell, and the app repaints the edit page as the setting
|
||||
* changes. Call close() when the window closes so an open edit is ended.
|
||||
*/
|
||||
export class WindowMenu {
|
||||
private stack: LayerStack | null = null;
|
||||
private reported: { hasAppMenu: boolean; claimsLongPress: boolean } | null = null;
|
||||
/** A text-setting row opened the phone editor and nothing has closed it yet. */
|
||||
private textEditOpen = false;
|
||||
|
||||
constructor(private readonly options: WindowMenuOptions) {}
|
||||
|
||||
@@ -105,11 +111,39 @@ export class WindowMenu {
|
||||
paint: () => this.options.paintBase(),
|
||||
handleInput: () => {},
|
||||
};
|
||||
const stack = new LayerStack(base, { ...noopLayerActions }, this.options.size, this.options.isFocused);
|
||||
const stack = new LayerStack(base, this.layerActions(), this.options.size, this.options.isFocused);
|
||||
stack.push(new WindowMenuLayer(title, items));
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
/** Close the menu outright (the window is closing), ending any phone edit. */
|
||||
close(): void {
|
||||
this.stack?.clearToBase();
|
||||
this.stack = null;
|
||||
this.endTextEdit();
|
||||
}
|
||||
|
||||
/**
|
||||
* No-ops apart from the phone text editor, which the shell owns: a worker
|
||||
* can only ask for it by setting id.
|
||||
*/
|
||||
private layerActions(): LayerActions {
|
||||
return {
|
||||
...noopLayerActions,
|
||||
startTextSettingEdit: (setting) => {
|
||||
this.textEditOpen = true;
|
||||
this.options.post({ type: "start-text-setting-edit", settingId: setting.id });
|
||||
},
|
||||
endTextSettingEdit: () => this.endTextEdit(),
|
||||
};
|
||||
}
|
||||
|
||||
private endTextEdit(): void {
|
||||
if (!this.textEditOpen) return;
|
||||
this.textEditOpen = false;
|
||||
this.options.post({ type: "end-text-setting-edit" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Paint the window content with the menu over it. `content` paints the
|
||||
* closed-state content (default: paintBase alone), for windows whose
|
||||
@@ -142,8 +176,7 @@ export class WindowMenu {
|
||||
// The shell opened its system menu over this window; close ours so the
|
||||
// two context menus never stack.
|
||||
if (event.type === "system-menu-opened") {
|
||||
stack.clearToBase();
|
||||
this.stack = null;
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
await stack.handleInput(event);
|
||||
|
||||
Reference in new issue
Block a user