Reduce to a pure on/off extension
Durations were the only thing keeping a lot of machinery alive, so drop them and let the dead code go with them. Removed: - The "Caffeinate for a Duration" command. - lib/duration.ts entirely (parseDuration / formatDuration / formatRemaining / normalizeDuration / DURATION_PRESETS) plus its test file. Every export was reachable only from duration paths. - The 30s setInterval re-render in the status view. It existed only to keep a "27m left" countdown honest, and with no timed sessions there is nothing to count down. - The duration-preset actions in the status view. - describeOptions(), which only the duration form used to explain itself. - durationSeconds / expiresAt from the options, state and command builder, along with the `-t <seconds>` and `sleep <n>` branches. Both platforms now hold the assertion until signalled, which is what "on" means here. - The unused "restarted" member of ToggleResult. The status view now reports "since <time>" instead of a countdown, and keeps a Refresh action. Also fixes a type error the narrower helper surfaced: the status view's run() helper was typed () => Promise<void> while startCaffeination returns Promise<CaffeinateState> and stopCaffeination returns Promise<boolean>. 407 deletions against 57 insertions. Verified: vici lint, tsc --noEmit, eslint, 8/8 vitest, vici build, and live in Vicinae — toggle on spawns `caffeinate -i`, toggle off stops it, and a pre-existing user-owned `caffeinate -u -dmi` is left untouched throughout.
This commit is contained in:
+1
-7
@@ -21,12 +21,6 @@
|
||||
"title": "Caffeination Status",
|
||||
"description": "See whether sleep is currently being prevented, and for how much longer. Start or stop it from here.",
|
||||
"mode": "view"
|
||||
},
|
||||
{
|
||||
"name": "caffeinate-for",
|
||||
"title": "Caffeinate for a Duration",
|
||||
"description": "Keep your computer awake for a set amount of time, then let it sleep again automatically.",
|
||||
"mode": "view"
|
||||
}
|
||||
],
|
||||
"preferences": [
|
||||
@@ -74,4 +68,4 @@
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user