Move Terminal and Navigate settings out of the Settings app and into their respective apps

This commit is contained in:
James Babcock committed 2026-09-30 21:52:56 -07:00
1 parent 4bc3551135
commit 2ff764d6ea
11 files changed
+114 -72

No files matched your search

+1 -1
View File
@@ -311,7 +311,7 @@ function openGlanceSettings(ctx: LayerContext): void {
uiFontOverridePickerMenuItem(glanceFont, {
title: "Glanceboard font",
description:
"Typeface for the Glanceboard's widgets. Same as UI font follows the Font setting in Settings > Display.",
"Typeface for the Glanceboard's widgets. Same as UI font follows the Font setting in Settings > Customization.",
}),
enumSettingMenuItem(glanceDepthSetting),
];
+1 -1
View File
@@ -35,7 +35,7 @@ type BatteryItem = { label: string; percent: number; charging: boolean };
* battery indicators (the Wear OS watch's only while one is reachable), and
* the Timers app's countdowns: the top bar's contents plus timers, laid out
* for a card. Battery style and per-device visibility
* follow Settings > Display > Battery indicators, so the card agrees with
* follow Settings > Customization > Battery indicators, so the card agrees with
* the bar. Countdowns tick once a second only while one is running.
*/
export class SystemCardWidget implements GlanceWidget {
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* Saved and recent destinations for the Navigate app: Home and Work (plain
* address settings, also editable in the Settings app), custom named
* address settings), custom named
* destinations, and a recency list of resolved places. Pure settings-store
* accessors, usable from the worker and the main thread alike.
*/
+2 -2
View File
@@ -262,8 +262,8 @@ function post(message: WorkerAppReply): void {
global.postMessage(message);
}
// Destinations edited on the phone (the text editor, or the Settings app's
// Home/Work rows) repaint the idle list / the edit screen live.
// Destinations edited on the phone (the text editor) repaint the idle list /
// the edit screen live.
onSettingsStoreChanged((key) => {
// The token key repaints too: the phone editor writes it live during
// Edit token, and the idle page changes shape once one is set.
+1 -1
View File
@@ -22,7 +22,7 @@ export type SettingsAppWindow = {
/** The full in-process window record, for hosts that manage window lifecycle. */
inProcess: InProcessWindow;
requestRender: () => void;
/** Select a section in the left column by label (e.g. "Terminal"). */
/** Select a section in the left column by label (e.g. "Voice"). */
focusSection: (label: string) => void;
/** Whether the glasses-side text-setting editor is the top layer. */
isTextEditorOnTop: () => boolean;
+56 -13
View File
@@ -23,7 +23,7 @@
* Frames are painted here and submitted directly to the Java compositor from
* this worker's thread.
*
* Auto-reconnect (Settings > Terminal, default on): while any terminal window
* Auto-reconnect (window menu > Settings, default on): while any terminal window
* is open, a dropped control connection reconnects with exponential backoff;
* the first session list after reconnect delivers bells that rang while
* disconnected (attention + wake) via their advanced lastBellAt. A dropped
@@ -51,20 +51,31 @@ import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
import { G2MirrorClient, type G2MirrorClientOptions, type G2MirrorSession, type G2MirrorState } from "../../native/g2mirror-client";
import { onSettingsStoreChanged } from "../../native/settings-store";
import { clamp } from "../../util/numeric-util";
import { terminalAutoReconnectSetting, terminalLaunchPresetsSetting, terminalNewConnectionSetting, terminalWakeOnBellSetting } from "../../ui/dashboard-settings";
import {
enumSettingMenuItem,
terminalAutoReconnectSetting,
terminalDisplayModeSetting,
terminalLaunchPresetsSetting,
terminalNewConnectionSetting,
terminalVerticalPositionSetting,
terminalWakeOnBellSetting,
textSettingMenuItem,
toggleSettingMenuItem,
} from "../../ui/dashboard-settings";
import { terminalFontPickerMenuItem } from "../../ui/font-picker";
import { connectionDisplayName, loadConnections, parseConnectionString, saveConnections, TERMINAL_CONNECTIONS_KEY, updateConnection, type TerminalConnection } from "./connections";
import { TerminalEmulator } from "./terminal-emulator";
import { type MenuItem } from "../../ui/menu";
import { drawSubmenuIndicator, type MenuItem } from "../../ui/menu";
import { Menu, type MenuDrawArgs } from "../../ui/menu-core";
import { lineStep, listRowHeight } from "../../ui/metrics";
import { WindowMenu } from "../../ui/window-menu";
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../../ui/metrics";
import { WindowMenu, WindowMenuLayer } from "../../ui/window-menu";
import { appViewportSize } from "../../ui/shell/geometry";
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
import type { ToolResult, ToolSpec } from "../../assistant/tool-registry";
declare const global: any;
// Cell geometry comes from the terminal font setting (Settings > Terminal >
// Cell geometry comes from the terminal font setting (window menu > Settings >
// Font; the default is Terminus-12's 6x12). Each window derives its grid from
// the viewport in its open-window message (the hub is min-height, session
// views full-height). Grid dimensions are baked into each session's websocket
@@ -92,6 +103,8 @@ const RECONNECT_MAX_DELAY_MS = 60_000;
// Storage key of terminalNewConnectionSetting (the Add-connection draft the
// phone text editor types into); its changes just repaint the add screen.
const NEW_CONNECTION_DRAFT_KEY = "terminal.newConnectionDraft";
// Storage key of terminalLaunchPresetsSetting, edited from the window menu.
const LAUNCH_PRESETS_KEY = "terminal.launchPresets";
type BaseWindow = {
windowId: string;
@@ -434,8 +447,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
};
// React to setting changes (connections edited here or in another isolate,
// toggles edited in the Settings app, the Add-connection draft typed on the
// phone).
// the window menu's settings, the Add-connection draft typed on the phone).
onSettingsStoreChanged((key) => {
if (key.startsWith("glanceboard.")) {
reportIdle();
@@ -462,8 +474,17 @@ onSettingsStoreChanged((key) => {
}
}
return;
case LAUNCH_PRESETS_KEY:
// Live keystrokes from the phone editor (Settings > Launch presets in
// the window menu): repaint its edit page, and the hub, whose host
// headings launch presets.
for (const window of windows.values()) {
if (window.menu?.isOpen()) scheduleRender(window);
}
renderHubWindows();
return;
default:
// launchPresets, wakeOnBell: no connection impact.
// wakeOnBell: no connection impact.
return;
}
});
@@ -539,6 +560,8 @@ function closeWindow(windowId: string): void {
// Window closed mid-add: shut the phone editor down.
endAddConnection(window);
}
// Likewise for a setting being edited from the window menu.
window.menu?.close();
windows.delete(windowId);
windowIconActivity.delete(windowId);
updateHubAnimation();
@@ -1032,8 +1055,12 @@ function windowMenuItems(window: TerminalWindow): MenuItem[] {
{
label: "Settings",
onSelect: (ctx) => {
ctx.stack.pop();
post({ type: "open-settings", section: "Terminal" });
ctx.stack.push(new WindowMenuLayer("Terminal settings", settingsMenuItems()));
},
render: ({ image, x, y, width, height, text }) => {
const font = chromeFont();
image.drawText(font, x, y + LIST_ROW_TEXT_INSET, text, 200);
drawSubmenuIndicator(image, font, x - 10, y, width + 20, height, 150);
},
},
];
@@ -1089,6 +1116,22 @@ function windowMenuItems(window: TerminalWindow): MenuItem[] {
return items;
}
/**
* The app's settings (the window menu's Settings submenu). Connections are
* managed in the hub's Manage Connections section instead.
*/
function settingsMenuItems(): MenuItem[] {
return [
enumSettingMenuItem(terminalDisplayModeSetting),
enumSettingMenuItem(terminalVerticalPositionSetting),
terminalFontPickerMenuItem(),
// Opens the phone text editor; the settings listener repaints its page.
textSettingMenuItem(terminalLaunchPresetsSetting),
toggleSettingMenuItem(terminalAutoReconnectSetting),
toggleSettingMenuItem(terminalWakeOnBellSetting),
];
}
function handleInput(window: TerminalWindow, event: InputEvent, frameId: number): void {
if (window.kind === "view") activeViewId = window.windowId;
// An open window menu owns all input (it closes itself via pop).
@@ -1565,7 +1608,7 @@ function openViewWindow(control: ControlConnection, socket: string, label: strin
});
}
/** Preset names the user listed in Settings > Terminal (the wire protocol has no way to enumerate the server's). */
/** Preset names the user listed in the app's settings (the wire protocol has no way to enumerate the server's). */
function launchPresetNames(): string[] {
const names: string[] = [];
for (const piece of terminalLaunchPresetsSetting.get().split(",")) {
@@ -1874,7 +1917,7 @@ function handleTerminalTool(name: string, args: any): ToolResult | Promise<ToolR
function toolListLaunchPresets(): ToolResult {
const presets = launchPresetNames();
if (!presets.length) {
return { ok: true, content: "No launch presets configured (Settings > Terminal > Launch presets)." };
return { ok: true, content: "No launch presets configured (Terminal window menu > Settings > Launch presets)." };
}
return { ok: true, content: presets.map((preset) => `- ${preset}`).join("\n") };
}
+8 -43
View File
@@ -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",
+5 -4
View File
@@ -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 -1
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -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);