[verified] merge upstream c162c8e6 into all-features

This commit is contained in:
MasterControl committed 2026-11-14 23:24:08 +00:00
commit 5790e98d27
176 files changed
+5311 -2307

No files matched your search

+74 -10
View File
@@ -10,8 +10,10 @@ import {
statusBarPositionSetting,
statusBarVisibilitySetting,
uiDepthSetting,
type WindowBorder,
windowBorderSetting,
} from "../dashboard-settings";
import { type EdgeKind, type Edges, uniformEdges, type Viewport, viewportWith } from "../viewport";
/** The paired glasses' screen, which the shell lays out in (graphics/screen-size.ts). */
export { screenHeight, screenWidth };
@@ -190,28 +192,59 @@ export function switcherRect(heightMode: WindowHeightMode, appId?: string): { x:
}
}
/**
* Which lines the chrome draws round the foreground window (Settings >
* Customization > Border): all of them, only the one between the window and
* the status bar, or none. The choice is a bottom or popup switcher's; a
* side strip always has its lines.
*/
export function windowBorder(): WindowBorder {
return sideStrip() ? "all" : windowBorderSetting.get();
}
/**
* Whether the foreground window's content gets a rounded frame (drawn by
* the chrome layer). Its left and right sides take the pixel just outside
* the 576-wide window; there's no room around a Full Screen or immersive
* window, nor need beside a side strip. With a reserved bottom switcher row
* it otherwise always has one: the row's top edge is the frame's bottom side, as the window
* header's last row is its top. With a popup switcher it's the Window
* border setting's choice, and its top and bottom take a header or footer
* row of their own, except where the status bar's row next to the window
* serves.
* the chrome layer): with every border line on (windowBorder), where
* there's room. Its left and right sides take the pixel just outside the
* 576-wide window; there's no room around a Full Screen or immersive
* window, nor need beside a side strip. With a reserved bottom switcher
* row, the row's top edge is the frame's bottom side, as the window
* header's last row is its top. With a popup switcher, its top and bottom
* take a header or footer row of their own, except where the status bar's
* row next to the window serves.
*/
export function windowFramed(appId?: string): boolean {
if (fullWidth(appId) || windowBorder() !== "all") return false;
switch (switcherPosition()) {
case "bottom":
return switcherRowHeight(appId) > 0 && !fullWidth(appId);
return switcherRowHeight(appId) > 0;
case "popup":
return !fullWidth(appId) && windowBorderSetting.get();
return true;
default:
return false;
}
}
/**
* Whether a line divides a status bar with rows of its own (the top bar, or
* a popup switcher's at the bottom) from the window. A window frame's side
* is that line where there is one (chrome-layer.ts statusBarPlacement).
*/
export function statusBarDivider(): boolean {
return windowBorder() !== "none";
}
/**
* Whether a line runs along a bottom switcher's top edge, between it and
* the window: a window frame's bottom side, or straight across where the
* window has no room for a frame. As the status line alone, only where the
* status bar shares the row.
*/
export function switcherRowDivider(appId?: string): boolean {
const border = windowBorder();
return border === "all" || (border === "status" && statusInSwitcherRow(appId));
}
/**
* Whether the status bar shares the bottom switcher row instead of topping
* each window (Settings > Customization > Status bar position): only beside
@@ -450,6 +483,37 @@ export function appViewportSize(mode: WindowHeightMode, appId?: string): { width
};
}
/**
* What each edge of an app's windows touches (see viewport.ts EdgeKind): a
* line the chrome draws right outside it, or nothing. A framed window has a
* line on every side. Otherwise the top or bottom has one where a status bar
* with rows of its own, or a bottom switcher row, lies past it and the
* Border setting divides the two; a side has one only beside a side strip,
* whose separator it is. An immersive window has the whole panel, and so
* none.
*/
export function windowEdges(appId?: string): Edges<EdgeKind> {
if (isImmersive(appId)) return uniformEdges("offscreen");
if (windowFramed(appId)) return uniformEdges("border");
const position = switcherPosition();
const line = (drawn: boolean): EdgeKind => (drawn ? "border" : "offscreen");
const statusLine = (edge: "top" | "bottom") => windowEdgeHeight(edge, appId) === TOP_BAR_HEIGHT && statusBarDivider();
return {
top: line(statusLine("top")),
right: line(position === "right"),
bottom: line(position === "bottom" ? switcherRowHeight(appId) > 0 && switcherRowDivider(appId) : statusLine("bottom")),
left: line(position === "left"),
};
}
/**
* A window's viewport as its layouts get it: the app-content size for its
* height mode, what its edges touch, and the padding suggested for them.
*/
export function appViewport(mode: WindowHeightMode, appId?: string): Viewport {
return viewportWith(appViewportSize(mode, appId), windowEdges(appId));
}
/** Screen rect of a window's app-content viewport (between its header and footer). */
export function appViewportRect(mode: WindowHeightMode, appId?: string): {
x: number;