forked from Blendman974/faceclaw
Various UI tweaks
Fix missing submenu indicators and change their appearance. Clean up styling in the Terminal app and move Settings to the top-level menu. Remove right padding from the bottom bar.
This commit is contained in:
1 parent
eff32d4a5a
commit
295922effd
12 files changed
+95
-96
No files matched your search
@@ -5,7 +5,7 @@ import { copyRemoteToken, remoteInterfaces } from '../../native/remote-input';
|
||||
import { TextViewerLayer } from '../../apps/files/text-viewer';
|
||||
import { ConfigSettingString, textSettingMenuItem } from '../dashboard-settings';
|
||||
import { getDefaultSmallFont } from '../../graphics/ui-fonts';
|
||||
import { drawRightValueMenuItem, type MenuItem } from '../menu';
|
||||
import { drawRightValueMenuItem, submenuItem, type MenuItem } from '../menu';
|
||||
import { type LayerContext } from '../layers';
|
||||
import { openSettingsSubMenu } from './settings-panel';
|
||||
|
||||
@@ -86,5 +86,5 @@ function openTokens(ctx: LayerContext): void {
|
||||
]);
|
||||
}
|
||||
export function remoteInputMenuItem(): MenuItem {
|
||||
return { label: 'Input tokens', description: 'Allow another app to provide ring/watch input, type into the foreground window, or send messages to the voice assistant. Create tokens with individual permissions and revoke them here.', onSelect: openTokens };
|
||||
return submenuItem('Input tokens', openTokens, { description: 'Allow another app to provide ring/watch input, type into the foreground window, or send messages to the voice assistant. Create tokens with individual permissions and revoke them here.' });
|
||||
}
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
} from "../../native/asr-model";
|
||||
import { TextViewerLayer } from "../../apps/files/text-viewer";
|
||||
import type { LayerContext } from "../layers";
|
||||
import { drawRightValueMenuItem, openModalMenu, type MenuItem } from "../menu";
|
||||
import { drawRightValueMenuItem, openModalMenu, submenuItem, type MenuItem } from "../menu";
|
||||
import { shell } from "../shell/shell";
|
||||
import {
|
||||
anthropicApiKeySetting,
|
||||
@@ -262,17 +262,17 @@ function customizationRows(): () => MenuItem[] {
|
||||
}
|
||||
|
||||
function autoBrightnessMenuItem(): MenuItem {
|
||||
return {
|
||||
label: "Auto-brightness",
|
||||
description: "Adjust the minimum, maximum, and ambient-light curve used by Auto brightness.",
|
||||
onSelect: (ctx) => {
|
||||
return submenuItem(
|
||||
"Auto-brightness",
|
||||
(ctx) => {
|
||||
openSettingsSubMenu(ctx, "Auto-brightness", [
|
||||
enumSettingMenuItem(autoBrightnessMinSetting),
|
||||
enumSettingMenuItem(autoBrightnessMaxSetting),
|
||||
textSettingMenuItem(autoBrightnessCurveSetting),
|
||||
]);
|
||||
},
|
||||
};
|
||||
{ description: "Adjust the minimum, maximum, and ambient-light curve used by Auto brightness." },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -310,16 +310,16 @@ function batteryIndicatorsMenuItem(): MenuItem {
|
||||
|
||||
/** The Customization section's "Animations" row: opens a modal submenu of animation toggles. */
|
||||
function animationsMenuItem(): MenuItem {
|
||||
return {
|
||||
label: "Animations",
|
||||
description: "Turn off menu and icon-grid motion, or the fade when the screen turns on and off.",
|
||||
onSelect: (ctx) => {
|
||||
return submenuItem(
|
||||
"Animations",
|
||||
(ctx) => {
|
||||
openSettingsSubMenu(ctx, "Animations", [
|
||||
toggleSettingMenuItem(menuAnimationSetting),
|
||||
toggleSettingMenuItem(screenFadeSetting),
|
||||
]);
|
||||
},
|
||||
};
|
||||
{ description: "Turn off menu and icon-grid motion, or the fade when the screen turns on and off." },
|
||||
);
|
||||
}
|
||||
|
||||
const LOCAL_MODEL_GB = `${(LOCAL_MODEL.sizeBytes / 1e9).toFixed(1)}GB`;
|
||||
|
||||
+21
-2
@@ -140,7 +140,7 @@ export function drawListScrollbar(
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a ">" submenu indicator inset at the right edge of a row's selection
|
||||
* Draw a "▶>" submenu indicator inset at the right edge of a row's selection
|
||||
* highlight box, vertically centered within it. Pass the same rect as the
|
||||
* row's drawSelectionHighlight call (the row need not actually be selected).
|
||||
*/
|
||||
@@ -153,12 +153,31 @@ export function drawSubmenuIndicator(
|
||||
highlightHeight: number,
|
||||
value: number,
|
||||
): void {
|
||||
const arrow = ">";
|
||||
const arrow = "▶";
|
||||
const x = highlightX + highlightWidth - font.measureText(arrow) - 4;
|
||||
const y = centeredTextY(font, highlightY, highlightHeight);
|
||||
image.drawText(font, x, y, arrow, value);
|
||||
}
|
||||
|
||||
/** A row that opens a nested menu: the label plus a right-edge ">". */
|
||||
export function submenuItem(
|
||||
label: string,
|
||||
onSelect: MenuItem["onSelect"],
|
||||
options: Pick<MenuItem, "description" | "disabled"> = {},
|
||||
): MenuItem {
|
||||
return {
|
||||
...options,
|
||||
label,
|
||||
onSelect,
|
||||
render: ({ image, x, y, width, height, selected, disabled, text }) => {
|
||||
const font = getDefaultSmallFont();
|
||||
const value = disabled ? 70 : selected ? 255 : 200;
|
||||
image.drawText(font, x, y + LIST_ROW_TEXT_INSET, text, value);
|
||||
drawSubmenuIndicator(image, font, x, y, width, height, value);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function drawToggleMenuItem(
|
||||
image: GrayImage,
|
||||
font: UiFont,
|
||||
|
||||
@@ -71,9 +71,8 @@ const ROW_STEP = ROW_ICON_SIZE + ICON_SPACING;
|
||||
// (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;
|
||||
// Its clock ends flush with the row's right end, which is the window's
|
||||
// right edge; batteries keep the top bar's clock-to-icons gap from it.
|
||||
const ROW_CLOCK_GAP = 16;
|
||||
// Between the windows' end of the row (its scroll chevron) and the status.
|
||||
const ROW_STATUS_GAP = 8;
|
||||
@@ -501,7 +500,7 @@ export class ShellChromeLayer implements Layer {
|
||||
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);
|
||||
const clockX = row.x + row.width - 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);
|
||||
|
||||
Reference in new issue
Block a user