Add configuration options to the glanceboard system card and music card

This commit is contained in:
James Babcock committed 2026-10-13 16:41:14 -07:00
1 parent 13da595de0
commit df95cc4064
12 files changed
+367 -107

No files matched your search

+5 -3
View File
@@ -3,6 +3,7 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { weatherBridge } from "../../native/weather";
import { onAnySettingChanged } from "../../ui/dashboard-settings";
import { shell } from "../../ui/shell/shell";
import { isSystemCardWidgetInUse } from "../glanceboard/configuration";
import { drawWeatherReading, measureWeatherReading, weatherReading, type WeatherReading } from "./weather-icons";
import { weatherShowInStatusBarSetting, weatherShowOnSystemCardSetting } from "./weather-settings";
@@ -16,8 +17,9 @@ let trayShown: { key: string; font: UiFont } | null = null;
/**
* Shell-lifetime subscription: keeps the hourly background refresh running
* while the status-bar or system-card indicator is enabled, and the tray
* icon in sync. The system card reads the bridge itself while it shows.
* while the status-bar indicator is enabled, or the system-card one is and
* the system card is on an enabled Glanceboard, and the tray icon in sync.
* The system card reads the bridge itself while it shows.
*/
export function startWeatherIndicators(): void {
if (started) return;
@@ -28,7 +30,7 @@ export function startWeatherIndicators(): void {
function syncWeatherIndicators(): void {
const inStatusBar = weatherShowInStatusBarSetting.get();
weatherBridge.setBackgroundRefresh(inStatusBar || weatherShowOnSystemCardSetting.get());
weatherBridge.setBackgroundRefresh(inStatusBar || (weatherShowOnSystemCardSetting.get() && isSystemCardWidgetInUse()));
const reading = inStatusBar ? weatherReading(weatherBridge.snapshot(), Date.now()) : null;
const font = getDefaultSmallFont();
+6 -2
View File
@@ -14,11 +14,15 @@ export const weatherShowInStatusBarSetting = new ConfigSettingBoolean({
"Show the current conditions and temperature in the top bar. Weather for your current location is fetched once an hour while the glasses are connected.",
});
/**
* Also the Weather toggle in the system card's Glanceboard settings. On by
* default: it only fetches while the system card is on an enabled board.
*/
export const weatherShowOnSystemCardSetting = new ConfigSettingBoolean({
id: "weather-show-on-system-card",
label: "Show on system card",
storageKey: "weather.showOnSystemCard",
defaultValue: false,
defaultValue: true,
description:
"Show the current conditions and temperature on the Glanceboard's system card. Weather for your current location is fetched once an hour while the glasses are connected.",
"Show the current conditions and temperature on the Glanceboard's system card. Weather for your current location is fetched once an hour while the glasses are connected and the system card is on the Glanceboard.",
});