Idle Time Setup
Show paste-ready snippet to wire the idle-timing fragment into your existing statusline
Idle-time statusline setup
Goal: help the user add the statusline-fragment to their existing statusline script and enable periodic refresh.
Steps:
-
Locate the user's current statusline configuration. Read
~/.claude/settings.json(may not exist; may be namedsettings.local.json; project-scoped settings may be at.claude/settings.jsonin the working directory). Extract thestatusLine.commandstring and any existingstatusLine.refreshIntervalvalue. -
If a
statusLine.commandis set, read the script it points to (handle leadingbash,sh, env substitutions like${HOME}or$HOME, and~). Confirm it reads stdin once into a variable (look for$(cat)or an equivalent) — the snippet assumes that. -
Print a short summary:
- The path of the statusline script being patched
- Whether
refreshIntervalis already set and its current value - The plugin root path: note that
$CLAUDE_PLUGIN_ROOTis set when the script runs as a hook, but the statusline script runs outside hook context — use the hardcoded installed path instead.
-
Print the paste-ready snippet the user can drop into their statusline script. If the script already assigns stdin to a variable named
input, use that name; otherwise suggest renaming. The fragment reads the full statusline JSON from stdin so it can see bothsession_idandmodel.id(used to blank the timer with---when the model changes). Place the snippet just before the final output assembly. Example snippet:# --- idle-timing fragment --- idle=$(echo "$input" | node "/path/to/idle-timing/scripts/statusline-fragment.js" 2>/dev/null || true) [ -n "$idle" ] && parts+=("$idle") # --- /idle-timing fragment ---Substitute the actual installed plugin path (e.g.
/home/<user>/src/claude-inject-idle-timefor local installs, or the path under~/.claude/plugins/for marketplace installs).If the script does not use a
partsbash array, show a variant that appends directly to the output string instead:# --- idle-timing fragment --- idle=$(echo "$input" | node "/path/to/idle-timing/scripts/statusline-fragment.js" 2>/dev/null || true) [ -n "$idle" ] && result="$result | $idle" # --- /idle-timing fragment --- -
Print the settings change to enable periodic refresh:
{ "statusLine": { "command": "<existing command>", "refreshInterval": 1 } }Tell the user to add
"refreshInterval": 1(seconds) to theirstatusLineobject in~/.claude/settings.json. Note that without it, the fragment still updates on every event (new message, tool result) but will not tick while idle. -
Do NOT modify any files. This command prints instructions only.
-
Close with a one-line test hint: start a new Claude Code session, wait a few seconds after Claude replies, and you should see the elapsed time appear in the statusline and tick once per second.