Files
caffeinate-extension/package.json
T
adrianbonpin a303e161d3 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.
2026-09-20 17:01:30 +08:00

71 lines
2.1 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/vicinaehq/vicinae/refs/heads/main/extra/schemas/extension.json",
"name": "caffeinate",
"title": "Caffeinate",
"description": "Keep your computer awake. Start, stop, and time-limit sleep prevention without touching a terminal.",
"icon": "caffeinate.png",
"author": "adrianbonpin",
"categories": [
"System"
],
"license": "MIT",
"commands": [
{
"name": "toggle",
"title": "Toggle Caffeination",
"description": "Start or stop keeping your computer awake, depending on the current state.",
"mode": "no-view"
},
{
"name": "status",
"title": "Caffeination Status",
"description": "See whether sleep is currently being prevented, and for how much longer. Start or stop it from here.",
"mode": "view"
}
],
"preferences": [
{
"name": "preventDisplaySleep",
"title": "Also Prevent Display Sleep",
"description": "Keep the screen on as well. Off means the display may still turn off while the system stays awake.",
"type": "checkbox",
"label": "Prevent display sleep",
"required": false,
"default": false
},
{
"name": "preventSystemSleep",
"title": "Also Prevent System Sleep",
"description": "Prevents full system sleep. Note: on macOS this assertion only takes effect while on AC power.",
"type": "checkbox",
"label": "Prevent system sleep",
"required": false,
"default": false
}
],
"dependencies": {
"@vicinae/api": "^0.29.0"
},
"devDependencies": {
"@eslint/js": "^9.36.0",
"@types/node": "22.13.10",
"@types/react": "19.1.17",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.8",
"globals": "^16.4.0",
"prettier": "^3.5.3",
"react": "19.1.1",
"typescript": "^5.8.2",
"typescript-eslint": "^8.45.0",
"vitest": "^4.1.5"
},
"scripts": {
"dev": "vici develop",
"build": "vici build",
"lint": "vici lint",
"lint:code": "eslint .",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest"
}
}