Option to combine top bar with the app switcher

This commit is contained in:
James Babcock committed 2026-10-02 00:45:17 -07:00
1 parent eab839f811
commit 756e21feb8
19 files changed
+462 -168

No files matched your search

+7 -4
View File
@@ -71,7 +71,7 @@ import { loadPersistedOpenApps, savePersistedOpenApps } from "../ui/shell/open-a
import { appViewportRect, isOnSwitcherEdge, sidebarStripVisible, type WindowHeightMode } from "../ui/shell/geometry";
import { type LayerActions, type TextSettingsEditToggle } from "../ui/layers";
import { type KeyboardInputSession } from "../ui/shell/keyboard-input";
import { appSwitcherPositionSetting, assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, getBrightnessPreferences, displayModeSetting, navigateDisplayModeSetting, navigateVerticalPositionSetting, terminalDisplayModeSetting, terminalVerticalPositionSetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, ringConnectionModeSetting, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, suspendEvenHubWhenScreenOffSetting, verticalPositionSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
import { appSwitcherPositionSetting, statusBarPositionSetting, assistantAllowProactiveSetting, assistantBackendSetting, assistantBridgeHostSetting, assistantBridgePortSetting, assistantBridgeTokenSetting, getBrightnessPreferences, displayModeSetting, navigateDisplayModeSetting, navigateVerticalPositionSetting, terminalDisplayModeSetting, terminalVerticalPositionSetting, elevenLabsApiKeySetting, getStringSettingById, openAiApiKeySetting, nightscoutApiTokenSetting, firmwareDebugFlagsSetting, lockScreenEnabledSetting, nightscoutSiteUrlSetting, onAnySettingChanged, previewColorSetting, ringConnectionModeSetting, saveVoiceRecordingsSetting, sonioxApiKeySetting, screenTimeoutSetting, screenTimeoutSettingToMs, suspendEvenHubWhenScreenOffSetting, verticalPositionSetting, voiceProviderSetting, wakeWordActionSetting, type ConfigSettingString } from "../ui/dashboard-settings";
import { isIgnoringBatteryOptimizations, requestIgnoreBatteryOptimizations } from "../native/battery-optimization";
import {
getInstalledEvenHubAppById,
@@ -182,11 +182,14 @@ const EVEN_APP_DETECTED_MESSAGE =
const LAUNCHABLE_APPS = ALL_APPS.filter((app) => app.showInLauncher !== false);
/**
* The global settings window viewport sizes depend on: the display mode, and
* whether the app switcher takes width beside windows or height below them.
* The global settings window viewport sizes depend on: the display mode,
* whether the app switcher takes width beside windows or height below them,
* and, below them, whether the status bar joins it (dropping the top bar).
*/
function viewportSizesKey(): string {
return `${displayModeSetting.get()}|${appSwitcherPositionSetting.get() === "bottom" ? "row" : "strip"}`;
const switcher = appSwitcherPositionSetting.get() !== "bottom" ? "strip"
: statusBarPositionSetting.get() === "switcher" ? "row+status" : "row";
return `${displayModeSetting.get()}|${switcher}`;
}
/** The global settings that move window surfaces without resizing them. */
+1 -1
View File
@@ -26,7 +26,7 @@ export type FirmwareInfo = {
};
/** The Faceclaw firmware revision this build of the app needs. */
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 35;
export const REQUIRED_FACECLAW_FIRMWARE_VERSION = 36;
const FACECLAW_PREFIX = "Faceclaw/";
const LEGACY_PREFIX = "EVENCFW";
+8 -8
View File
@@ -19,7 +19,7 @@ export type FirmwarePatchSet = {
export const CFW_PATCH_SET: FirmwarePatchSet = {
"base": "g2_2.3.0.24.bin",
"baseSha256": "187ccf2bcc5c17a212106e8a376745511e8289c4232b634a7ea94b9bf25a0979",
"outputSha256": "354f23f88a4aaf9c56cf62078bf13e814faa25b1fbb4dc69a7754110d6502386",
"outputSha256": "0c262bee7ee38b3387426933a8abd631cd6caed9896ababfcd881224686631f8",
"patches": [
{
"offset": 1045797,
@@ -210,43 +210,43 @@ export const CFW_PATCH_SET: FirmwarePatchSet = {
{
"offset": 4537963,
"old": "",
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf80b5002a18bf10f0030301d186460ce000f1010c864600bf013a0ef8011b04d01cf003030cf1010cf6d1102a11d35ffa81fc4ff001330cfb03fc00bf103acef80cc0cef808c0cef804c04ef810cb0f2af4d8042a0bd35ffa81fc4ff001330cfb03fc00bf043a032a4ef804cbfad8002a08bf80bdaef10103013a03f8011ffbd180bd00bf2de9f04fc7b04ff29c5bc2f2290b4ff6ff754ff47d7400274ff0010847f67f7a7f261191cde90f3007e000bf48f2a351c0f24501bff32f8f8847dbf80090bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14068b0f57d7f00f096804ff47d7006f0c8fc002800f0c8814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160446080f80e80a0f8c4a180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001f49457ff452afbff35f8f4be8000121b15be8001f4945f8d047e74ff47d7800274ff0010a47f67f797f2607e000bf48f2a351c0f24501bff32f8f8847dbf80040bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f098804ff47d7006f006fc002800f006814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80ea0a0f8c49180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001fa1427ff451afbff35f8f00bf4be8000121b15be8001fa142f8d045e7d0f8944242f6f76ac0f2440a002cbff35f8f4bd00af19a0220464ff0ff314ff0ff379047002840f09081119800285fd010980778a7f11700022859d811980c2840f07d81109b58789978084300f07781d8780138022800f272819a79d9795e7a42ea0122197a187942ea014242ea06619a7ade7a93f805c0192f42ea062200f0c981172f40f0df81002a40f05881fe2800f03e86812800f03086002840f045865cea010040f04b8100f092be04460020d047d0b104f5257151e8004f5cb9bff35f8f00bf41e80002002a00f0e38051e8004f002cf6d00021bff32f8f0029bff35f8f00f0d380044694e74ff0ff372ce147f6df40c0f24f000e94804700274ff47d784ff0010947f67f744ff07f0a1397adf8507007e000bf48f2a351c0f24501bff32f8f8847dbf80060bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f09f804ff47d7006f0c0fa002800f097804ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80e90a0f8c44180f8c3a1058445848584c584058545858585c585058645868586c586058745878587c5875be8001fb1427ff451afbff35f8f00bf4be8000159b15be8001fb142f8d045e70af5a9718847bfe6012121e70020109f42f6f76ac0f2440a9fb1119989b1397801f07f02b2f10b0418bf0124b2f11c0618bf01268a2928dc0b292ad01c2928d041e00f9012a803f037ff4ff0ff374ff001080e9c9df85100002812a818bf4ff0ff3704f04ff8b8f1000f054608d19df8500028b94af21f30c0f247004c3080470f98002818bf056115e09c2901d08b2919d168b14af21f31c0f247010746884797f8681121b997f824133846109f51b10e9c4ff0ff370af5807120468847384647b0bde8f08f0f9012a804ea060803f0f3fe387800f07f041e2c05d11199384607f048fe0746b4e71d2c00f07e0018bf1a2819d1dbf800100322cff680720a40b2f1005fbff35f8f12d10a684ef66c63ccf2ff039a420bd14a68b2f57d7f04bf002281f8a12303e0a4f115010129e1d90f2c12dc092c00f31781052c00f0c982072c40f0c183cdf8348000274ff0010947f67f764ff07f0852e0142c00f3ea81102c00f08083112c40f0ae8311980e9c022806d13878112803d17878002800f09a864ff0ff3765e7bcf1000f4ff0ff3708bf00298fd11328bff48daf102a4ff0000138bf01211228b2fa82f218bf510901297ff480af00f0c5bc182f4ff0ff3708bfbcf1000f7ff476af00297ff473af352800f34284002800f09c84012800f0aLine truncated
"new": "b0b581ea00039b0701d0034637e0c2b110f0030315d000f1010ca2f1010e0023cc5c9e45c45403f1010404d0634413f003032346f4d121440319121b102a14d302e00346102a10d3d1f800c0d1f804e0cc688d68103adc609d60c3f804e043f810cb0f2a01f11001eed8042a07d300bf51f8045b043a032a43f8045bf8d8002a08bfb0bd0139013b11f8015f013a03f8015ff9d1b0bd00bf884218bf002a00d1704710b50b1a38bf431a934207d288420ad281ea00039b0726d0034669e0fff79fffbde81040704781ea000300eb020c9b0701eb020e42d15fea8c732bd0a0f1010c00bf8b1813f801ec8418531e04f801ec04d0624412f003021a46f2d101eb030e00eb030c17e0830736d0a2f1010c00f1010e002300bfcc5c9c45c45403f1010404d0734413f003032346f4d1121b2144031922e01346042b0ed3aef10402acf1040152f80449043b032b41f80449f8d802f1040e01f1040c1a4653b1aef10101acf1010300bf11f80149013a03f80149f9d1bde8104070470346042a06d351f8044b043a032a43f8044bf8d8002af0d00139013b00bf11f8014f013a03f8014ff9d1e6e700bf80b5002a18bf10f0030301d186460ce000f1010c864600bf013a0ef8011b04d01cf003030cf1010cf6d1102a11d35ffa81fc4ff001330cfb03fc00bf103acef80cc0cef808c0cef804c04ef810cb0f2af4d8042a0bd35ffa81fc4ff001330cfb03fc00bf043a032a4ef804cbfad8002a08bf80bdaef10103013a03f8011ffbd180bd00bf2de9f04fc7b04ff29c5bc2f2290b4ff6ff754ff47d7400274ff0010847f67f7a7f261191cde90f3007e000bf48f2a351c0f24501bff32f8f8847dbf80090bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14068b0f57d7f00f096804ff47d7006f0c8fc002800f0c8814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160446080f80e80a0f8c4a180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001f49457ff452afbff35f8f4be8000121b15be8001f4945f8d047e74ff47d7800274ff0010a47f67f797f2607e000bf48f2a351c0f24501bff32f8f8847dbf80040bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f098804ff47d7006f006fc002800f006814ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80ea0a0f8c49180f8c361058445848584c584058545858585c585058645868586c586058745878587c5875be8001fa1427ff451afbff35f8f00bf4be8000121b15be8001fa142f8d045e7d0f8944242f6f76ac0f2440a002cbff35f8f4bd00af19a0220464ff0ff314ff0ff379047002840f09081119800285fd010980778a7f11700022859d811980c2840f07d81109b58789978084300f07781d8780138022800f272819a79d9795e7a42ea0122197a187942ea014242ea06619a7ade7a93f805c0192f42ea062200f0c981172f40f0df81002a40f05881fe2800f03e86812800f03086002840f045865cea010040f04b8100f092be04460020d047d0b104f5257151e8004f5cb9bff35f8f00bf41e80002002a00f0e38051e8004f002cf6d00021bff32f8f0029bff35f8f00f0d380044694e74ff0ff372ce147f6df40c0f24f000e94804700274ff47d784ff0010947f67f744ff07f0a1397adf8507007e000bf48f2a351c0f24501bff32f8f8847dbf80060bff35f8fdbf800000321cff680710140b1f1005fbff35f8f0bd101684ef66c62ccf2ff02914204d14168b1f57d7f00f09f804ff47d7006f0c0fa002800f097804ff60c41cff6ff7100bf42182e3182f8f47382f8f57382f8f67382f8f77382f8f87382f8f97382f8fa7382f8fb7382f8fc7382f8fd7382f8fe7382f8ff7382f8007482f8017482f8027482f8037482f8047482f8057482f8067482f8077482f8087482f8097482f80a7482f80b7482f80c7482f80d7482f80e7482f80f7482f8107482f8117482f8127482f8137482f8147482f8157482f8167482f8177482f8187482f8197482f81a7482f81b7482f81c7482f81d7482f81e7482f81f7482f8207482f82174a0d14ef66c61ccf2ff010160c0f8048080f80e90a0f8c44180f8c3a1058445848584c584058545858585c585058645868586c586058745878587c5875be8001fb1427ff451afbff35f8f00bf4be8000159b15be8001fb142f8d045e70af5a9718847bfe6012121e70020109f42f6f76ac0f2440a9fb1119989b1397801f07f02b2f10b0418bf0124b2f11c0618bf01268a2928dc0b292ad01c2928d041e00f9012a803f037ff4ff0ff374ff001080e9c9df85100002812a818bf4ff0ff3704f04ff8b8f1000f054608d19df8500028b94af21f30c0f247004c3080470f98002818bf056115e09c2901d08b2919d168b14af21f31c0f247010746884797f8681121b997f824133846109f51b10e9c4ff0ff370af5807120468847384647b0bde8f08f0f9012a804ea060803f0f3fe387800f07f041e2c05d11199384607f048fe0746b4e71d2c00f07e0018bf1a2819d1dbf800100322cff680720a40b2f1005fbff35f8f12d10a684ef66c63ccf2ff039a420bd14a68b2f57d7f04bf002281f8a12303e0a4f115010129e1d90f2c12dc092c00f31781052c00f0c982072c40f0c183cdf8348000274ff0010947f67f764ff07f0852e0142c00f3ea81102c00f08083112c40f0ae8311980e9c022806d13878112803d17878002800f09a864ff0ff3765e7bcf1000f4ff0ff3708bf00298fd11328bff48daf102a4ff0000138bf01211228b2fa82f218bf510901297ff480af00f0c5bc182f4ff0ff3708bfbcf1000f7ff476af00297ff473af352800f34284002800f09c84012800f0aLine truncated
"desc": "append injected blobs to main-app payload"
},
{
"offset": 779123,
"old": "805a3900",
"new": "186e3a00",
"new": "a86f3a00",
"desc": "main-app subheader payload size (ps)"
},
{
"offset": 152,
"old": "005b3900",
"new": "986e3a00",
"new": "28703a00",
"desc": "main-app TOC entry size (ps + 128)"
},
{
"offset": 779243,
"old": "805a3904",
"new": "186e3a04",
"new": "a86f3a04",
"desc": "main-app preamble length (low 24 bits)"
},
{
"offset": 779247,
"old": "effdbcea",
"new": "cbb2ae81",
"new": "a65bcd38",
"desc": "[5] ota/s200_firmware_ota.bin preamble crc32"
},
{
"offset": 156,
"old": "c0c6322a",
"new": "35dc5a11",
"new": "27573dd4",
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (TOC)"
},
{
"offset": 779127,
"old": "c0c6322a",
"new": "35dc5a11",
"new": "27573dd4",
"desc": "[5] ota/s200_firmware_ota.bin component crc32c (subheader)"
}
]
+21 -4
View File
@@ -11,11 +11,18 @@ export const DrawOp = { RECT_COPY: 2, IMAGE: 4, ROUNDED_RECT: 8, CLEAR: 9, DRAWS
export const DISPLAY_LIST_RECORD = 7;
/** Bridge opcode bit: a clip rect follows the call's depth. */
const CLIPPED = 128;
/** Bridge sentinel for a rounded rect without an outside color. */
const NO_OUTSIDE = 16;
export type ListImage = { readonly width: number; readonly height: number; readonly pixels: Uint8Array };
/** Revision 35: a call draws only inside its clip, in list coordinates (and moves with its depth). */
export type ListClip = { readonly x: number; readonly y: number; readonly width: number; readonly height: number };
export type ListCall = (
| { op: typeof DrawOp.ROUNDED_RECT; x: DrawValue; y: DrawValue; width: number; height: number; radius: number; background: number; border: number }
/**
* The background max-blends (0 leaves the interior alone); border 16 draws no
* outline. `outside` (revision 36) colors the box's pixels outside the
* rounded shape, cutting what is underneath to the corners.
*/
| { op: typeof DrawOp.ROUNDED_RECT; x: DrawValue; y: DrawValue; width: number; height: number; radius: number; background: number; border: number; outside?: number }
| { op: typeof DrawOp.IMAGE; resource: number; x: number; y: number; transparent: boolean }
| { op: typeof DrawOp.RECT_COPY; resource: number; x: DrawValue; y: DrawValue; width: number; height: number; dx: DrawValue; dy: DrawValue }
/** Fill with a 4-bit color: the clip rect when there is one, else the whole screen. */
@@ -88,6 +95,7 @@ export function encodeDisplayList(placed: PlacedDisplayList, now = Date.now()):
out.raw(encodeValue(call.x)); out.raw(encodeValue(call.y));
out.u16(integer(call.width, 1, 640)); out.u16(integer(call.height, 1, 480)); out.u16(call.radius);
out.u8(integer(call.background, 0, 15)); out.u8(integer(call.border, 0, 16));
out.u8(call.outside === undefined ? NO_OUTSIDE : integer(call.outside, 0, 15));
} else if (call.op === DrawOp.CLEAR) {
out.u8(integer(call.color, 0, 15));
} else if (call.op === DrawOp.DRAWS) {
@@ -127,7 +135,11 @@ export function readDisplayList(bytes: Uint8Array, offset: number, now = Date.no
const header = r.u8(), op = header & ~CLIPPED, callDepth = r.i16();
const clip = header & CLIPPED ? { x: r.i16(), y: r.i16(), width: r.u16(), height: r.u16() } : undefined;
const common = clip ? { depth: callDepth, clip } : { depth: callDepth };
if (op === DrawOp.ROUNDED_RECT) calls.push({ op, ...common, x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), radius: r.u16(), background: r.u8(), border: r.u8() });
if (op === DrawOp.ROUNDED_RECT) {
const call = { op, ...common, x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), radius: r.u16(), background: r.u8(), border: r.u8() };
const outside = r.u8();
calls.push(outside === NO_OUTSIDE ? call : { ...call, outside });
}
else if (op === DrawOp.IMAGE) calls.push({ op, ...common, resource: r.u16(), x: r.i16(), y: r.i16(), transparent: (r.u8() & 16) !== 0 });
else if (op === DrawOp.RECT_COPY) calls.push({ op, ...common, resource: r.u16(), x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), dx: readValue(r), dy: readValue(r) });
else if (op === DrawOp.CLEAR) calls.push({ op, ...common, color: r.u8() });
@@ -157,7 +169,8 @@ export function dimDisplayList(list: DisplayList, factor: number): DisplayList {
if (list.calls.some(c => c.op === DrawOp.DRAWS)) return { ...list, calls: [] };
const dim = (v: number) => v === 0 ? 0 : Math.max(1, Math.round(v * factor));
return { ...list, resources: list.resources.map(r => ({ ...r, pixels: r.pixels.map(dim) })),
calls: list.calls.map(c => c.op === DrawOp.ROUNDED_RECT ? { ...c, background: Math.min(15, Math.round(c.background * factor)), border: c.border === 16 ? 16 : Math.min(15, Math.round(c.border * factor)) }
calls: list.calls.map(c => c.op === DrawOp.ROUNDED_RECT ? { ...c, background: Math.min(15, Math.round(c.background * factor)), border: c.border === 16 ? 16 : Math.min(15, Math.round(c.border * factor)),
...(c.outside === undefined ? {} : { outside: Math.min(15, Math.round(c.outside * factor)) }) }
: c.op === DrawOp.CLEAR ? { ...c, color: Math.min(15, Math.round(c.color * factor)) } : c) };
}
@@ -191,8 +204,12 @@ export function paintDisplayList(output: Uint8Array, screen: Uint8Array, width:
} else if (c.op === DrawOp.ROUNDED_RECT) {
const x = placed.x + evaluate(c.x, elapsed, presentTime).value + shift, y = placed.y + evaluate(c.y, elapsed, presentTime).value;
for (let yy = 0; yy < c.height; yy++) for (let xx = 0; xx < c.width; xx++) {
if (!writable(x + xx, y + yy) || !inside(xx, yy, c.width, c.height, c.radius)) continue;
if (!writable(x + xx, y + yy)) continue;
const p = (y + yy) * width + x + xx;
if (!inside(xx, yy, c.width, c.height, c.radius)) {
if (c.outside !== undefined) output[p] = c.outside * 16;
continue;
}
output[p] = c.border !== 16 && !inside(xx - 1, yy - 1, c.width - 2, c.height - 2, Math.max(0, c.radius - 1)) ? c.border * 16 : Math.max(output[p], c.background * 16);
}
} else {
+19
View File
@@ -393,6 +393,25 @@ export const uiDepthSetting = new ConfigSettingEnum<UiDepth>({
"Moves the whole display nearer (positive) or farther away (negative) by shifting it in opposite directions on the two lenses. Available with the app switcher at the bottom. Full-panel windows lose a sliver at the edges.",
});
/**
* Where the status bar (clock, notification icons, app widgets, batteries)
* goes: the top bar over each window, or the right end of a bottom app
* switcher's row (geometry.ts statusInSwitcherRow), where windows grow into
* the top bar's height.
*/
export type StatusBarPosition = "top" | "switcher";
export const statusBarPositionSetting = new ConfigSettingEnum<StatusBarPosition>({
id: "status-bar-position",
label: "Status bar",
storageKey: "display.statusBarPosition",
defaultValue: "top",
values: ["top", "switcher"],
formatValue: (value) => value === "switcher" ? "With app switcher" : "Top",
description:
"Where the clock, notification icons, app widgets and battery indicators go. With app switcher puts them at the right end of the app switcher's row, and windows grow into the top bar's space. Available with the app switcher at the bottom; the full-panel display mode keeps the top bar. Changing it reopens open apps in the new size.",
});
export const brightnessSetting = new ConfigSettingEnum<BrightnessSetting>({
id: "brightness",
label: "Brightness",
+5 -1
View File
@@ -29,6 +29,7 @@ import { shell } from "../shell/shell";
import {
anthropicApiKeySetting,
appSwitcherPositionSetting,
statusBarPositionSetting,
uiDepthSetting,
assistantAllowProactiveSetting,
assistantBackendSetting,
@@ -243,6 +244,9 @@ function customizationRows(): () => MenuItem[] {
const position = enumSettingMenuItem(appSwitcherPositionSetting);
// The whole display's stereo depth; the shell sends it with its scene.
const depth = enumSettingMenuItem(uiDepthSetting);
// Top bar, or the right end of the switcher row; the dashboard controller
// resizes windows on change.
const statusBar = enumSettingMenuItem(statusBarPositionSetting);
const rest = [
// Submenu: top-bar battery indicator style plus per-device visibility.
batteryIndicatorsMenuItem(),
@@ -253,7 +257,7 @@ function customizationRows(): () => MenuItem[] {
// Opens the modal font picker (face, weight, size) for UI text.
uiFontPickerMenuItem(),
];
const withDepth = [position, depth, ...rest], withoutDepth = [position, ...rest];
const withDepth = [position, depth, statusBar, ...rest], withoutDepth = [position, ...rest];
return () => appSwitcherPositionSetting.get() === "bottom" ? withDepth : withoutDepth;
}
+149 -69
View File
@@ -1,6 +1,7 @@
import { shellCrop } from "../../graphics/shell-scene";
import type { Plane } from "../../graphics/plane";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { DrawOp } from "../../graphics/display-list";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage, grayToNibble } from "../../graphics/image";
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
import { truncateText } from "../../graphics/textwrap";
import { activeAmbientCards } from "./ambient-cards";
@@ -31,11 +32,13 @@ import {
SHELL_OPAQUE_BLACK,
SIDEBAR_WIDTH,
sidebarStripVisible,
statusInSwitcherRow,
SWITCHER_ROW_HEIGHT,
switcherPosition,
switcherRect,
TOP_BAR_HEIGHT,
windowFramed,
windowHeaderHeight,
windowTop,
type WindowHeightMode,
} from "./geometry";
@@ -63,6 +66,21 @@ const LIST_HEIGHT = MIN_WINDOW_HEIGHT - TOP_BAR_HEIGHT - 2 * LIST_MARGIN;
const ROW_ICON_SIZE = SWITCHER_ROW_HEIGHT - 4;
const ROW_STEP = ROW_ICON_SIZE + ICON_SPACING;
// The status bar in the switcher row (geometry.ts statusInSwitcherRow) keeps
// the top bar's layout, so every element sits as it does there: its 28 rows
// (whose last is the divider, which the row has no use for) centred in the
// row below its separator line.
const ROW_STATUS_TOP = 1 + ((SWITCHER_ROW_HEIGHT - TOP_BAR_HEIGHT) >> 1);
// Its clock ends this far from the row's right end, as the top bar's starts
// from its left; batteries keep the top bar's clock-to-icons gap from it.
const ROW_STATUS_EDGE_MARGIN = 10;
const ROW_CLOCK_GAP = 16;
// Between the windows' end of the row (its scroll chevron) and the status.
const ROW_STATUS_GAP = 8;
// Notification icons stop short of room for this many windows' slots (or
// all of them, when there are fewer); the windows take whatever is left.
const ROW_MIN_WINDOW_SLOTS = 3;
/** Icon rows that fit in one sidebar column. */
function rowsPerColumn(variant: SidebarVariant): number {
return Math.max(1, ((LIST_HEIGHT + ICON_SPACING) / (variant.iconSize + ICON_SPACING)) | 0);
@@ -107,15 +125,20 @@ type SwitcherLayout = {
cell: (slot: number) => SwitcherCell;
};
/** Switcher geometry for the foreground window (a bottom row sits under it). */
function switcherLayout(windowCount: number, heightMode: WindowHeightMode, appId?: string): SwitcherLayout {
/**
* Switcher geometry for the foreground window (a bottom row sits under it).
* `windowsRight` is where a bottom row's window icons must end: short of
* the status bar when it shares the row.
*/
function switcherLayout(windowCount: number, heightMode: WindowHeightMode, appId?: string, windowsRight?: number): SwitcherLayout {
const position = switcherPosition();
if (position === "bottom") {
const row = switcherRect(heightMode, appId);
const width = (windowsRight ?? row.x + row.width) - row.x;
return {
position,
iconSize: ROW_ICON_SIZE,
visibleCount: Math.max(1, ((row.width - 2 * LIST_MARGIN + ICON_SPACING) / ROW_STEP) | 0),
visibleCount: Math.max(1, ((width - 2 * LIST_MARGIN + ICON_SPACING) / ROW_STEP) | 0),
cell: (slot) => ({
x: row.x + LIST_MARGIN - 2 + slot * ROW_STEP, y: row.y, width: ROW_ICON_SIZE + 4, height: SWITCHER_ROW_HEIGHT,
atSeparator: true,
@@ -280,18 +303,21 @@ export function makeImageWindowIcon(
export class ShellChromeLayer implements Layer {
// First switcher icon shown; adjusted each paint to keep the selection visible.
private scrollRow = 0;
// Where the last paint ended a bottom row's window icons, for hit testing.
private rowWindowsRight: number | undefined;
constructor(private readonly getState: () => ShellChromeState) {}
paint(): GrayImage {
const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
const state = this.getState();
const statusInRow = statusInSwitcherRow(state.foregroundAppId);
// Full-panel mode: the strip is an overlay, present only while the user
// is in it (the window underneath keeps its full width the rest of the time).
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
this.drawSidebar(image, state);
this.drawSidebar(image, state, statusInRow ? image : undefined);
}
this.drawTopBar(image, state);
if (!statusInRow) this.drawTopBar(image, state);
const frame = windowFrameRect(state);
if (frame) drawWindowFrame(image, frame);
drawAmbientCards(image, topBarSpan(state).right);
@@ -300,29 +326,32 @@ export class ShellChromeLayer implements Layer {
paintParts(): Plane[] {
const state = this.getState(), parts: Plane[] = [];
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
this.drawSidebar(canvas, state);
const strip = switcherRect(state.foregroundHeightMode, state.foregroundAppId);
parts.push(shellCrop(canvas, strip.x, strip.y, strip.width, strip.height, 1));
}
const statusInRow = statusInSwitcherRow(state.foregroundAppId);
const canvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
this.drawTopBar(canvas, state);
const bar = topBarSpan(state);
parts.push({ ...shellCrop(canvas, bar.left, windowTop(state.foregroundHeightMode, state.foregroundAppId), bar.right - bar.left, TOP_BAR_HEIGHT, 2), depth: -2 });
const frame = windowFrameRect(state);
if (frame) {
// Over the top bar, whose bottom row it shares, but at the screen's
// own depth rather than the bar's -2, which on top of a -62 screen
// depth would shift a side off the screen. Split into its two sides
// (corners included) and the top between them, as one surface would
// be almost all transparent.
const frameCanvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
drawWindowFrame(frameCanvas, frame);
const [leftKey, rightKey, topKey] = windowFrameKeys(), sideHeight = frame.height - 1;
parts.push(shellCrop(frameCanvas, frame.x, frame.y, FRAME_RADIUS, sideHeight, leftKey));
parts.push(shellCrop(frameCanvas, frame.x + frame.width - FRAME_RADIUS, frame.y, FRAME_RADIUS, sideHeight, rightKey));
parts.push(shellCrop(frameCanvas, frame.x + FRAME_RADIUS, frame.y, frame.width - 2 * FRAME_RADIUS, 1, topKey));
if (!statusInRow) {
this.drawTopBar(canvas, state);
parts.push({ ...shellCrop(canvas, bar.left, windowTop(state.foregroundHeightMode, state.foregroundAppId), bar.right - bar.left, TOP_BAR_HEIGHT, 2), depth: -2 });
}
if (sidebarStripVisible(state.focus, state.foregroundAppId)) {
const stripCanvas = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
const statusLeft = this.drawSidebar(stripCanvas, state, statusInRow ? canvas : undefined);
// The window frame rides on the switcher row, whose top edge is its
// bottom side, and so replays after any top bar, whose bottom row is
// its top. It plays at the screen's own depth rather than the bar's
// -2, which on top of a -62 screen depth would shift a side off the
// screen. (A framed window always has the row on screen.)
const frame = windowFrameRect(state);
if (frame) drawWindowFrame(stripCanvas, frame);
const strip = switcherRect(state.foregroundHeightMode, state.foregroundAppId);
parts.push(shellCrop(stripCanvas, strip.x, strip.y, strip.width, strip.height, 1));
if (statusLeft !== null) {
// The status bar keeps the top bar's surface and its depth, -2, over
// the row's right end below its separator line, so the clock ticking
// doesn't resend the window icons.
const right = strip.x + strip.width;
parts.push({ ...shellCrop(canvas, statusLeft, strip.y + 1, right - statusLeft, strip.height - 1, 2), depth: -2 });
}
}
drawAmbientCards(canvas, bar.right, parts);
return parts;
@@ -341,7 +370,7 @@ export class ShellChromeLayer implements Layer {
windowIndexAt(x: number, y: number, windowCount: number): number | null {
if (windowCount === 0) return null;
const state = this.getState();
const layout = switcherLayout(windowCount, state.foregroundHeightMode, state.foregroundAppId);
const layout = switcherLayout(windowCount, state.foregroundHeightMode, state.foregroundAppId, this.rowWindowsRight);
const lastVisible = Math.min(windowCount, this.scrollRow + layout.visibleCount);
for (let index = this.scrollRow; index < lastVisible; index++) {
const cell = layout.cell(index - this.scrollRow);
@@ -352,7 +381,13 @@ export class ShellChromeLayer implements Layer {
return null;
}
private drawSidebar(image: GrayImage, state: ShellChromeState): void {
/**
* Draw the switcher strip or row. Given `statusImage`, a bottom row shares
* its right end with the status bar, drawn there (into that image, which
* may be this one) first, and the window icons take what it leaves.
* Returns the status bar's left edge, or null without one.
*/
private drawSidebar(image: GrayImage, state: ShellChromeState, statusImage?: GrayImage): number | null {
// A side strip aligns with the app's preferred band (legacy tall
// terminal sessions keep it at the global band position); a bottom row
// sits under the foreground window.
@@ -365,7 +400,11 @@ export class ShellChromeLayer implements Layer {
// visible slot's column is decided by its position within the scrolled
// window.
const count = state.windows.length;
const layout = switcherLayout(count, state.foregroundHeightMode, state.foregroundAppId);
const statusLeft = statusImage && switcherPosition() === "bottom"
? this.drawRowStatus(statusImage, state, strip, count) : null;
const windowsRight = statusLeft === null ? strip.x + strip.width : statusLeft - ROW_STATUS_GAP;
this.rowWindowsRight = windowsRight;
const layout = switcherLayout(count, state.foregroundHeightMode, state.foregroundAppId, windowsRight);
const { iconSize, position } = layout;
this.scrollRow = scrollToKeepSelectionVisible(this.scrollRow, state.selectedIndex, layout.visibleCount, count);
const lastVisible = Math.min(count, this.scrollRow + layout.visibleCount);
@@ -410,15 +449,15 @@ export class ShellChromeLayer implements Layer {
}
if (position === "bottom") {
// Chevrons sit in the row's end margins, pointing off either end.
// Chevrons sit in the margins at either end of the icons, pointing off them.
const chevronY = strip.y + ((strip.height / 2) | 0);
if (this.scrollRow > 0) {
drawChevron(image, strip.x + 6, chevronY, "left");
}
if (lastVisible < count) {
drawChevron(image, strip.x + strip.width - 6, chevronY, "right");
drawChevron(image, windowsRight - 6, chevronY, "right");
}
return;
return statusLeft;
}
// Chevrons center over the icon area, which in the one-column variant is
// narrower than the sidebar strip.
@@ -430,6 +469,45 @@ export class ShellChromeLayer implements Layer {
if (lastVisible < count) {
drawChevron(image, chevronX, strip.y + strip.height - 6, "down");
}
return null;
}
/**
* The status bar at the right end of the switcher row, right to left:
* date and time, batteries, app widgets, then notification icons, each as
* it sits in the top bar (see ROW_STATUS_TOP). Notification icons stop
* short of room for a few window slots; the windows get the rest, and
* whatever they leave over is free space between the two. Returns the
* left edge of what it drew.
*/
private drawRowStatus(image: GrayImage, state: ShellChromeState, row: Rect, windowCount: number): number {
image.fillRect(row.x, row.y + 1, row.width, row.height - 1, SHELL_OPAQUE_BLACK);
const top = row.y + ROW_STATUS_TOP;
const font = getDefaultMediumFont();
const clock = clockText();
const clockX = row.x + row.width - ROW_STATUS_EDGE_MARGIN - font.measureText(clock);
image.drawText(font, clockX, top + Math.max(0, ((TOP_BAR_HEIGHT - font.lineHeight) / 2) | 0), clock, 210);
// The battery block keeps its usual right margin inside the edge it's given.
const batteryLeft = this.drawTopBarBatteries(image, state, top, clockX - ROW_CLOCK_GAP + BATTERY_BLOCK_RIGHT_MARGIN);
const trayLeft = drawTrayIcons(image, state.trayIcons, batteryLeft, top);
// Right-aligned against the widgets, with the top bar's spacing.
const slots = Math.min(windowCount, ROW_MIN_WINDOW_SLOTS);
const windowsFloor = row.x + 2 * LIST_MARGIN + Math.max(0, slots * ROW_STEP - ICON_SPACING) + ROW_STATUS_GAP;
const iconsRight = trayLeft - 8, step = NOTIFICATION_ICON_SIZE + 4;
const maxIcons = Math.max(0, ((iconsRight - windowsFloor + 4) / step) | 0);
if (maxIcons === 0) return trayLeft;
const { icons, stale } = readActiveNotificationIcons(maxIcons, renderPassAllowsStaleData());
if (stale) {
noteStaleDataUsed();
}
if (!icons.length) return trayLeft;
const iconsLeft = iconsRight - icons.length * step + 4;
const iconY = top + (((TOP_BAR_HEIGHT - NOTIFICATION_ICON_SIZE) / 2) | 0);
for (let index = 0; index < icons.length; index++) {
image.drawImage(icons[index]!, iconsLeft + index * step, iconY);
}
return iconsLeft;
}
private drawTopBar(image: GrayImage, state: ShellChromeState): void {
@@ -447,8 +525,7 @@ export class ShellChromeLayer implements Layer {
image.drawLine(barLeft, barTop + TOP_BAR_HEIGHT - 1, barRight - 1, barTop + TOP_BAR_HEIGHT - 1, BORDER_VALUE);
}
const now = new Date();
const clock = `${formatClockDate(now)} ${formatClockTime(now)}`;
const clock = clockText();
const clockX = barLeft + 10;
const textY = barTop + Math.max(0, ((TOP_BAR_HEIGHT - font.lineHeight) / 2) | 0);
image.drawText(font, clockX, textY, clock, 210);
@@ -545,6 +622,12 @@ export class ShellChromeLayer implements Layer {
type BatteryItem = { label: string; device: BatteryDevice; percent: number; charging: boolean };
/** The status bar's date and time. */
function clockText(): string {
const now = new Date();
return `${formatClockDate(now)} ${formatClockTime(now)}`;
}
const BATTERY_BLOCK_RIGHT_MARGIN = 8;
const BATTERY_LABEL_VALUE = 150;
@@ -629,7 +712,7 @@ const AMBIENT_MAX_LINES_PER_CARD = 3;
/**
* Paint the active ambient cards bottom-up: the oldest card sits at the very
* bottom of the window band and newer ones stack above it. Cards that would
* cross into the top bar are dropped rather than clipped. `right` is the
* cross into the window header are dropped rather than clipped. `right` is the
* top bar's right edge, which the cards align to.
*/
const ambientKeys = new Map<string, number>();
@@ -647,7 +730,7 @@ function drawAmbientCards(image: GrayImage, right: number, parts?: Plane[]): voi
const lines = [card.title, ...card.lines].slice(0, 1 + AMBIENT_MAX_LINES_PER_CARD);
const height = 2 * AMBIENT_CARD_PADDING_Y + lines.length * lineStep(font);
const y = bottom - height;
if (y < bandTop + TOP_BAR_HEIGHT) break;
if (y < bandTop + windowHeaderHeight()) break;
const target = parts ? new GrayImage(image.width, image.height, 0) : image;
target.fillRect(x, y, AMBIENT_CARD_WIDTH, height, SHELL_OPAQUE_BLACK);
target.drawRect(x, y, AMBIENT_CARD_WIDTH, height, 90);
@@ -701,12 +784,13 @@ type Rect = { x: number; y: number; width: number; height: number };
const FRAME_RADIUS = 8;
/**
* The rounded frame around the foreground window's content (below its top
* bar), when it has one (geometry.ts windowFramed): one pixel all round.
* The rounded frame around the foreground window's content (below its
* header), when it has one (geometry.ts windowFramed): one pixel all round.
* Its sides run down the pixel just outside each side of the window, and
* its top is the top bar's bottom row, in place of the bar's divider. Its
* bottom is the switcher row's top edge, where drawSeparator draws it so
* the selection tab can divert it.
* its top is the header's last row: the top bar's, in place of the bar's
* divider, or the whole one-row header with the status bar in the switcher
* row. Its bottom is the switcher row's top edge, where drawSeparator draws
* it so the selection tab can divert it.
*/
function windowFrameRect(state: ShellChromeState): Rect | null {
if (!windowFramed(state.foregroundAppId)) return null;
@@ -714,34 +798,31 @@ function windowFrameRect(state: ShellChromeState): Rect | null {
return { x: viewport.x - 1, y: viewport.y - 1, width: viewport.width + 2, height: viewport.height + 2 };
}
/** Shell surface keys of the window frame's left side, right side and top. */
let frameKeys: [number, number, number] | undefined;
function windowFrameKeys(): [number, number, number] {
if (!frameKeys) frameKeys = [LayerStack.allocateShellKey(), LayerStack.allocateShellKey(), LayerStack.allocateShellKey()];
return frameKeys;
/**
* Draw the window frame (see windowFrameRect) as one retained firmware
* rounded rect over whatever lies beneath it: no fill, so the window's
* content shows through, and black outside the curve, cutting the content's
* square corners to it. It is clipped short of its bottom row, which
* drawSeparator draws with the selection tab's gap.
*/
function drawWindowFrame(image: GrayImage, frame: Rect): void {
image.drawDisplayList({ resources: [], calls: [{
op: DrawOp.ROUNDED_RECT, x: 0, y: 0, width: frame.width, height: frame.height, radius: FRAME_RADIUS,
background: 0, border: grayToNibble(BORDER_VALUE), outside: 0,
clip: { x: 0, y: 0, width: frame.width, height: frame.height - 1 },
}] }, frame.x, frame.y, frame.width, frame.height);
}
/**
* Draw the window frame (see windowFrameRect) but for its bottom row,
* stroked line by line like the selection tab's outline. Outside each
* rounded corner it paints opaque black, so the window's square corners
* don't show past the curve. Everything but the top's straight run lies
* within FRAME_RADIUS of the sides.
* How far in from the frame's sides its top and bottom rows start: the
* first pixel whose centre passes the firmware's rounded-rect test, which
* the separator must match to join the corners.
*/
function drawWindowFrame(image: GrayImage, frame: Rect): void {
const { x, y, width, height } = frame;
for (let i = 0; i < height - 1; i++) {
const outer = tabInset(i, 0, height, FRAME_RADIUS);
image.fillRect(x, y + i, outer, 1, SHELL_OPAQUE_BLACK);
image.fillRect(x + width - outer, y + i, outer, 1, SHELL_OPAQUE_BLACK);
if (i === 0) {
image.fillRect(x + outer, y, width - 2 * outer, 1, BORDER_VALUE);
continue;
}
const stroke = Math.max(1, 1 + tabInset(i, 1, height - 1, FRAME_RADIUS - 1) - outer);
image.fillRect(x + outer, y + i, stroke, 1, BORDER_VALUE);
image.fillRect(x + width - outer - stroke, y + i, stroke, 1, BORDER_VALUE);
}
function frameEdgeInset(): number {
const r = FRAME_RADIUS, dy = 2 * r - 1;
let inset = 0;
while (inset < r && (2 * (r - inset) - 1) ** 2 + dy * dy > 4 * r * r) inset++;
return inset;
}
const TAB_RADIUS = 6;
@@ -763,9 +844,8 @@ function drawSeparator(
// Along the row's top edge: the full width of the row, or between the
// corners of the window frame, whose bottom side this is.
const frame = windowFrameRect(state);
const inset = frame ? tabInset(frame.height - 1, 0, frame.height, FRAME_RADIUS) : 0;
const left = frame ? frame.x + inset : strip.x;
const right = frame ? frame.x + frame.width - 1 - inset : strip.x + strip.width - 1;
const left = frame ? frame.x + frameEdgeInset() : strip.x;
const right = frame ? frame.x + frame.width - 1 - frameEdgeInset() : strip.x + strip.width - 1;
const y = strip.y;
if (gap) {
image.drawLine(left, y, gap.x, y, BORDER_VALUE);
+32 -13
View File
@@ -9,6 +9,7 @@ import {
navigateVerticalPositionSetting,
terminalDisplayModeSetting,
terminalVerticalPositionSetting,
statusBarPositionSetting,
uiDepthSetting,
} from "../dashboard-settings";
@@ -112,14 +113,32 @@ export function switcherRect(heightMode: WindowHeightMode, appId?: string): { x:
/**
* Whether the foreground window's content gets a rounded frame (drawn by
* the chrome layer): with a reserved bottom switcher row, whose top edge is
* the frame's bottom side, as the top bar's divider is its top. Its left and right sides take the pixel just outside
* the 576-wide window; there's no room in the full-panel mode, nor need
* beside a side strip.
* the frame's bottom side, as the window header's last row is its top. Its
* left and right sides take the pixel just outside the 576-wide window;
* there's no room in the full-panel mode, nor need beside a side strip.
*/
export function windowFramed(appId?: string): boolean {
return switcherRowHeight(appId) > 0;
}
/**
* Whether the status bar shares the bottom switcher row instead of topping
* each window (Settings > Customization > Status bar): only beside a
* reserved row, as the full-panel mode's row shows just while it has focus.
*/
export function statusInSwitcherRow(appId?: string): boolean {
return windowFramed(appId) && statusBarPositionSetting.get() === "switcher";
}
/**
* Height of the header the shell draws over each window's content: the top
* bar, or, with the status bar in the switcher row, just the row the
* window frame's top runs along.
*/
export function windowHeaderHeight(appId?: string): number {
return statusInSwitcherRow(appId) ? 1 : TOP_BAR_HEIGHT;
}
/**
* Whether a screen point lies on the switcher's side of the screen, for
* touches on the phone's mirror: anywhere in a side strip's column, or from
@@ -196,14 +215,14 @@ export const SHELL_OPAQUE_BLACK = 1;
/**
* Windows come in three heights. "min" covers the same 288px band the stock
* firmware uses, leaving most of the field of view clear; "medium" is one
* top bar taller, so the content area below the bar is a full 288px (the
* header taller, so the content area below the header is a full 288px (the
* EvenHub app surface height); "max" uses the whole 480px screen (terminal
* views), less a bottom switcher row. All include a top bar drawn by the
* shell at the window's top edge.
* views), less a bottom switcher row. All include a header drawn by the
* shell at the window's top edge (windowHeaderHeight).
*/
export type WindowHeightMode = "min" | "medium" | "max";
/** Total height (top bar + content) of a min-height window. */
/** Total height (header + content) of a min-height window. */
export const MIN_WINDOW_HEIGHT = 288;
/**
@@ -214,13 +233,13 @@ function windowAreaHeight(appId?: string): number {
return G2_LENS_HEIGHT - switcherRowHeight(appId);
}
/** Total height (top bar + content) of a window's band in the given mode. */
/** Total height (header + content) of a window's band in the given mode. */
export function windowBandHeight(mode: WindowHeightMode, appId?: string): number {
switch (effectiveHeightMode(mode, appId)) {
case "max":
return windowAreaHeight(appId);
case "medium":
return MIN_WINDOW_HEIGHT + TOP_BAR_HEIGHT;
return MIN_WINDOW_HEIGHT + windowHeaderHeight(appId);
default:
return MIN_WINDOW_HEIGHT;
}
@@ -257,7 +276,7 @@ export function minWindowTop(appId?: string): number {
}
/**
* Top edge (y) of a window's top bar; max-height windows pin to the screen
* Top edge (y) of a window's header; max-height windows pin to the screen
* top. A bottom switcher row hangs under the band, so the band and row
* together distribute the screen's slack.
*/
@@ -269,11 +288,11 @@ export function windowTop(mode: WindowHeightMode, appId?: string): number {
export function appViewportSize(mode: WindowHeightMode, appId?: string): { width: number; height: number } {
return {
width: appViewportWidth(appId),
height: windowBandHeight(mode, appId) - TOP_BAR_HEIGHT,
height: windowBandHeight(mode, appId) - windowHeaderHeight(appId),
};
}
/** Screen rect of a window's app-content viewport (below its top bar). */
/** Screen rect of a window's app-content viewport (below its header). */
export function appViewportRect(mode: WindowHeightMode, appId?: string): {
x: number;
y: number;
@@ -282,7 +301,7 @@ export function appViewportRect(mode: WindowHeightMode, appId?: string): {
} {
return {
x: appViewportLeft(appId),
y: windowTop(mode, appId) + TOP_BAR_HEIGHT,
y: windowTop(mode, appId) + windowHeaderHeight(appId),
...appViewportSize(mode, appId),
};
}
+2 -1
View File
@@ -41,6 +41,7 @@ import {
brightnessSetting,
onAnySettingChanged,
openAiApiKeySetting,
statusBarPositionSetting,
timeFormatSetting,
wakeWordActionSetting,
} from "../dashboard-settings";
@@ -337,7 +338,7 @@ const SWITCHER_SWIPES: Record<
* string.
*/
function chromeSettingsKey(): string {
return `${batteryIndicatorSettingsKey()}|${timeFormatSetting.get()}|${uiDepth()}`;
return `${batteryIndicatorSettingsKey()}|${timeFormatSetting.get()}|${uiDepth()}|${statusBarPositionSetting.get()}`;
}
class Shell {