forked from Blendman974/faceclaw
Status bar timer widget is selectable
This commit is contained in:
1 parent
132b90c21d
commit
9a0c843bc7
7 files changed
+68
-16
No files matched your search
@@ -44,6 +44,7 @@ import {
|
||||
parseTimersState,
|
||||
pushRecentDuration,
|
||||
serializeTimersState,
|
||||
soonestRunningTimer,
|
||||
stopwatchElapsedMs,
|
||||
timerRemainingMs,
|
||||
type Alarm,
|
||||
@@ -685,13 +686,8 @@ function alarmNotificationText(alarm: Alarm): string {
|
||||
|
||||
/** Remaining time of the timer that ends soonest, for the tray icon; null when none runs. */
|
||||
export function soonestRunningTimerRemainingMs(engine: TimerEngine, now = Date.now()): number | null {
|
||||
let soonest: number | null = null;
|
||||
for (const timer of engine.state.timers) {
|
||||
if (timer.endsAtMs === null || timer.rungAtMs !== null) continue;
|
||||
const remaining = timerRemainingMs(timer, now);
|
||||
if (soonest === null || remaining < soonest) soonest = remaining;
|
||||
}
|
||||
return soonest;
|
||||
const timer = soonestRunningTimer(engine.state.timers, now);
|
||||
return timer ? timerRemainingMs(timer, now) : null;
|
||||
}
|
||||
|
||||
export const timerEngine = new TimerEngine();
|
||||
Reference in new issue
Block a user