forked from Blendman974/faceclaw
Merge branch 'main' into ios-port
This commit is contained in:
commit
a31ddae4d2
49 files changed
+2068
-212
No files matched your search
@@ -6,7 +6,7 @@ import { BATTERY_ICON_WIDTH, drawBattery } from "../../graphics/battery";
|
||||
import { readActiveNotificationIcons } from "../../native/notification-icons";
|
||||
import { readPhoneBatteryState } from "../../native/phone-battery";
|
||||
import { noteStaleDataUsed, renderPassAllowsStaleData } from "../../util/render-freshness";
|
||||
import { renderIcon, renderIconWithGlyph, type IconName } from "../../graphics/icons";
|
||||
import { renderIcon, renderIconWithGlyph, type IconActivity, type IconName } from "../../graphics/icons";
|
||||
import { batteryDisplayModeSetting, timeFormatSetting } from "../dashboard-settings";
|
||||
import { Layer } from "../layers";
|
||||
import { scrollToKeepSelectionVisible } from "../menu";
|
||||
@@ -144,9 +144,9 @@ function invertedIcon(icon: GrayImage): GrayImage {
|
||||
}
|
||||
|
||||
/** Window icon rendered from an SVG (Lucide), rendered once per size and cached. */
|
||||
export function makeSvgWindowIcon(name: IconName, glyph?: string): ShellChromeWindow["drawIcon"] {
|
||||
export function makeSvgWindowIcon(name: IconName, glyph?: string, activity?: () => IconActivity): ShellChromeWindow["drawIcon"] {
|
||||
return (image, x, y, size, inverted) => {
|
||||
const icon = glyph ? renderIconWithGlyph(name, glyph, size) : renderIcon(name, size);
|
||||
const icon = glyph || activity ? renderIconWithGlyph(name, glyph ?? "", size, activity?.() ?? "idle") : renderIcon(name, size);
|
||||
if (!icon) return;
|
||||
const dx = x + Math.max(0, ((size - icon.width) / 2) | 0);
|
||||
const dy = y + Math.max(0, ((size - icon.height) / 2) | 0);
|
||||
@@ -155,8 +155,8 @@ export function makeSvgWindowIcon(name: IconName, glyph?: string): ShellChromeWi
|
||||
}
|
||||
|
||||
/** SVG icon when a name is given, else the letter placeholder. */
|
||||
export function windowIcon(icon: IconName | undefined, letter: string, glyph?: string): ShellChromeWindow["drawIcon"] {
|
||||
return icon ? makeSvgWindowIcon(icon, glyph) : makeLetterWindowIcon(letter);
|
||||
export function windowIcon(icon: IconName | undefined, letter: string, glyph?: string, activity?: () => IconActivity): ShellChromeWindow["drawIcon"] {
|
||||
return icon ? makeSvgWindowIcon(icon, glyph, activity) : makeLetterWindowIcon(letter);
|
||||
}
|
||||
|
||||
/** Window icon backed by an arbitrary cached grayscale image renderer. */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { windowIcon } from "./chrome-layer";
|
||||
import { type IconName } from "../../graphics/icons";
|
||||
import { type IconActivity, type IconName } from "../../graphics/icons";
|
||||
import { toolRegistry, type ToolResult, type ToolSpec } from "../../assistant/tool-registry";
|
||||
import { appViewportSize, type WindowHeightMode } from "./geometry";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
@@ -63,6 +63,8 @@ export type WorkerAppReply =
|
||||
}
|
||||
| { type: "set-title"; windowId: string; title: string }
|
||||
| { type: "set-attention"; windowId: string; attention: boolean }
|
||||
/** App-driven animation phase for sidebar icons that support an activity cursor. */
|
||||
| { type: "set-icon-activity"; windowId: string; activity: IconActivity }
|
||||
| {
|
||||
/** Open the shell's voice dialog aimed at this window (a menu pick). */
|
||||
type: "start-voice-input";
|
||||
@@ -197,6 +199,7 @@ const TOOL_CALL_HOST_TIMEOUT_MS = 15_000;
|
||||
|
||||
export class WorkerAppHost {
|
||||
private readonly openWindows = new Set<string>();
|
||||
private readonly windowIconActivity = new Map<string, IconActivity>();
|
||||
/** Per-window gesture bindings, as last reported (see set-window-gestures). */
|
||||
private readonly windowGestures = new Map<string, { hasAppMenu: boolean; claimsLongPress: boolean }>();
|
||||
private readonly pendingToolCalls = new Map<string, PendingToolCall>();
|
||||
@@ -282,6 +285,12 @@ export class WorkerAppHost {
|
||||
shell.openSystemMenu(message.windowId);
|
||||
}
|
||||
break;
|
||||
case "set-icon-activity":
|
||||
if (this.openWindows.has(message.windowId) && this.windowIconActivity.get(message.windowId) !== message.activity) {
|
||||
this.windowIconActivity.set(message.windowId, message.activity);
|
||||
this.options.requestShellRender();
|
||||
}
|
||||
break;
|
||||
case "set-window-gestures":
|
||||
this.windowGestures.set(message.windowId, {
|
||||
hasAppMenu: message.hasAppMenu,
|
||||
@@ -370,13 +379,14 @@ export class WorkerAppHost {
|
||||
close: () => {
|
||||
this.openWindows.delete(spec.windowId);
|
||||
this.windowGestures.delete(spec.windowId);
|
||||
this.windowIconActivity.delete(spec.windowId);
|
||||
// Withdraw this window's tools and fail any in-flight calls to it.
|
||||
toolRegistry.removeAppTools(spec.windowId);
|
||||
this.failPendingToolCallsFor(spec.windowId);
|
||||
this.post({ type: "close-window", windowId: spec.windowId });
|
||||
this.options.removeSurface(surfaceId);
|
||||
},
|
||||
drawIcon: windowIcon(spec.icon, spec.iconLetter, spec.iconGlyph),
|
||||
drawIcon: windowIcon(spec.icon, spec.iconLetter, spec.iconGlyph, () => this.windowIconActivity.get(spec.windowId) ?? "idle"),
|
||||
handleInput: (event, frameId) => {
|
||||
frameTimings.logFrame(frameId, `input posted to the ${this.options.appId} worker`);
|
||||
this.post({
|
||||
|
||||
Reference in new issue
Block a user