Add a distance unit option

This commit is contained in:
James Babcock committed 2026-10-26 00:45:10 -07:00
1 parent 22f869d31c
commit 1ec77a8ade
5 files changed
+82 -14

No files matched your search

+19 -2
View File
@@ -37,6 +37,7 @@ export type BatteryDisplayMode = "icon" | "percentage" | "stacked" | "stacked-pe
export type BatteryIndicatorVisibility = "always" | "low" | "never";
export type TimeFormat = "24h" | "12h";
export type TemperatureUnit = "fahrenheit" | "celsius";
export type DistanceUnit = "miles" | "kilometers";
export type ScreenTimeoutSetting = "15s" | "30s" | "1m" | "3m" | "never";
// Auto runs Faceclaw's light curve. Numeric values use the calibrated firmware
// scale, clamped to 2–100; 2 is also the endpoint for screen fades.
@@ -322,14 +323,17 @@ export function batteryIndicatorSettingsKey(): string {
].join("|");
}
/** Exported so the Navigate worker can repaint when it changes. */
export const TIME_FORMAT_SETTING_KEY = "display.timeFormat";
export const timeFormatSetting = new ConfigSettingEnum<TimeFormat>({
id: "timeFormat",
label: "Time format",
storageKey: "display.timeFormat",
storageKey: TIME_FORMAT_SETTING_KEY,
defaultValue: "24h",
values: ["24h", "12h"],
formatValue: timeFormatLabel,
description: "Whether the top-bar clock shows 24-hour or 12-hour time.",
description: "Whether the top-bar clock and other times of day, such as Navigate's arrival time, show 24-hour or 12-hour time.",
});
export const temperatureUnitSetting = new ConfigSettingEnum<TemperatureUnit>({
@@ -342,6 +346,19 @@ export const temperatureUnitSetting = new ConfigSettingEnum<TemperatureUnit>({
description: "Whether the Weather app, its top-bar indicator, and the Glanceboard's system card show temperatures in Fahrenheit or Celsius.",
});
/** Exported so the Navigate worker can repaint when it changes. */
export const DISTANCE_UNIT_SETTING_KEY = "display.distanceUnit";
export const distanceUnitSetting = new ConfigSettingEnum<DistanceUnit>({
id: "distanceUnit",
label: "Distance unit",
storageKey: DISTANCE_UNIT_SETTING_KEY,
defaultValue: "miles",
values: ["miles", "kilometers"],
formatValue: (value) => value === "kilometers" ? "Kilometers" : "Miles",
description: "Whether the Weather app shows wind speed in mph or km/h, and the Navigate app shows distances in miles and feet or kilometers and meters.",
});
/**
* Where the app switcher (the open-window icons) sits: a strip along the
* left or right edge of the display, a row under the window, or a popup box
+3
View File
@@ -49,6 +49,7 @@ import {
autoBrightnessMaxSetting,
autoBrightnessCurveSetting,
dataCollectionSetting,
distanceUnitSetting,
glassesBatteryVisibilitySetting,
phoneBatteryVisibilitySetting,
ringBatteryVisibilitySetting,
@@ -292,6 +293,8 @@ function customizationRows(): () => MenuItem[] {
enumSettingMenuItem(timeFormatSetting),
// Fahrenheit or Celsius, wherever weather temperatures show.
enumSettingMenuItem(temperatureUnitSetting),
// Miles or kilometers: Weather's wind speed and Navigate's distances.
enumSettingMenuItem(distanceUnitSetting),
];
const bottomRows = [font, position, depth, statusBar, ...rest];
const popupRows = [font, position, depth, statusBar, statusBarVisibility, windowBorder, ...rest];