Use the Terminal Widget command-line tool to update widgets from scripts, shell commands, and automation.
Usage
terminal-widget [--target NAME] [--text "STRING"] [--icon "SF_SYMBOL"] [--font "FONT NAME"] [--fg COLOR] [--bg COLOR] [--alpha A] [--progress N] [--sparkline "N N ..."] [--image PATH_OR_URL] [--padding N|--fullsize] [--command "CMD"] [--theme|--mode system|light|dark]
Options
--target NAMEWidget to update (matches Edit Widget “Target name”). If omitted, uses the last target written (.lastTarget), else the first registered widget name (widget1,widget2, …), elsewidget1.--text STRINGText line (shown above the progress bar when both are set)--icon SF_SYMBOLSF Symbol name; shown before text, or before the progress bar, or alone centered if nothing else is set--font "FONT NAME"Installed system font name used for text rendering (omitting--fontresets to default)--foreground COLORText/icon color (alias:--fg). AcceptsRRGGBB,#RRGGBB,rgb(r,g,b), orrgba(r,g,b,a).--background COLORWidget background color (alias:--bg). AcceptsRRGGBB,#RRGGBB,rgb(r,g,b), orrgba(r,g,b,a).--alpha AOverride alpha channel for--foreground/--backgroundthis update (0.0...1.0).--progress NInteger0-100for a progress bar; omit to hide the bar on this update--sparkline VALUESBar sparkline: numbers separated by spaces or commas (alias:--spark). Y-axis is min…max of the series; bar height uses 101 levels. Omit to clear. Max 128 points.--image IMAGE_PATHAbsolute/relative image path or anhttp(s)image URL--padding NWidget content padding in points (0-64). Useful to reduce margins around images.--fullsizeShortcut for--padding 0(edge-to-edge content)--command COMMANDRun command and use its stdout as text--theme MODEsystem,light, ordark--mode MODEAlias for--theme(system,light, ordark)--helpShow this help
Notes
- If both
--textand--commandare supplied,--commandoutput wins. - If
--textis omitted and stdin is piped, stdin is used as text. - Omitting both
--textand--commandclears the widget text line (for example:terminal-widget --progress 50only updates the bar). --commandruns withzsh -lc(login env + Homebrew paths). Fish functions are not visible; use a script on PATH or--text.- Icon-only: pass
--iconwith no--text,--command,--image,--progress, or--sparklineto show a centered symbol. - Omit
--foreground/--backgroundon a later update to reset those colors to theme defaults. --paddingand--fullsizepersist in payload until changed again for that target.- Updates the App Group JSON + prefs, then notifies the app via
SIGUSR1andterminalwidget:///update?sync=1&target=....
Command Examples
terminal-widget --target widget1 --text "Deploy complete" --icon "checkmark.circle.fill" --fg "#22c55e"
terminal-widget --target widget2 --command "pmset -g batt | head -1"
terminal-widget --target widget3 --image "https://picsum.photos/800/400" --fullsize
terminal-widget --target widget1 --progress 67 --text "Rendering"
terminal-widget --target widget1 --sparkline "5 12 8 21 34 55 89"
URL Scheme Examples
terminalwidget://update?target=widget1&text=Backup%20Complete&icon=externaldrive.fill
terminalwidget://update?target=widget2&progress=42&text=Syncing
terminalwidget://update?target=widget3&image=https%3A%2F%2Fpicsum.photos%2F640%2F360&padding=0
terminalwidget://update?target=widget1&sparkline=4,8,15,16,23,42
terminalwidget://update?target=widget2&theme=dark&fg=%23ffffff&bg=%23111417