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

+9 -2
View File
@@ -133,6 +133,7 @@ function indicatorHarness() {
const settings = new Map(), settingListeners = new Set(), stateListeners = new Set(), trays = [];
const background = [];
let state = { phase: 'ready', current: null, forecast: [], lastUpdatedMs: null };
let systemCardInUse = false;
class GrayImage {
constructor(width, height) { this.width = width; this.height = height; this.draws = []; }
drawImage(_source, x, y) { this.draws.push(['image', x, y]); }
@@ -158,10 +159,12 @@ function indicatorHarness() {
onAnySettingChanged: listener => { settingListeners.add(listener); return () => settingListeners.delete(listener); },
},
'../../ui/shell/shell': { shell: { setTrayIcon: (id, icon) => trays.push([id, icon]) } },
'../glanceboard/configuration': { isSystemCardWidgetInUse: () => systemCardInUse },
})('app/apps/weather/weather-indicators.ts');
return {
api, trays, background,
setSetting(key, value) { settings.set(key, value); for (const listener of settingListeners) listener(); },
setSystemCardInUse(value) { systemCardInUse = value; for (const listener of settingListeners) listener(); },
setState(next) { state = next; for (const listener of stateListeners) listener(state); },
};
}
@@ -169,12 +172,16 @@ function indicatorHarness() {
test('Weather tray icon follows the status-bar setting and hides a stale reading', () => {
const h = indicatorHarness();
h.api.startWeatherIndicators();
assert.deepEqual(h.background, [false]);
assert.deepEqual(h.background, [false], 'system-card weather is on by default, but no system card is showing');
assert.equal(h.trays.length, 0, 'nothing shown, nothing to clear');
h.setSetting('weather.showOnSystemCard', true);
h.setSystemCardInUse(true);
assert.equal(h.background.at(-1), true, 'the system card alone keeps refreshes running');
assert.equal(h.trays.length, 0);
h.setSetting('weather.showOnSystemCard', false);
assert.equal(h.background.at(-1), false, 'not with its weather turned off');
h.setSetting('weather.showOnSystemCard', true);
assert.equal(h.background.at(-1), true);
h.setSetting('weather.showInStatusBar', true);
const current = { temperatureF: 71.6, condition: 'rain', isDaytime: true };