docs/widgets.md
WidgetSnapshotStore writes compact JSON snapshots to the app-group container.Sources/CodexBarWidget contains timeline + views.WidgetSnapshot in the main app.CodexBarSwitcherWidget): static provider switcher widget, small/medium/large.CodexBarUsageWidget): configurable provider usage widget, small/medium/large.CodexBarHistoryWidget): configurable usage-history chart, medium/large.CodexBarCompactWidget): compact credits/today-cost/30-day-cost widget, small only.The configurable provider widgets currently expose: Codex, Claude, Gemini, Alibaba, Antigravity, z.ai, Copilot, MiniMax, Kilo, OpenCode, and OpenCode Go.
Providers without a ProviderChoice case can still be present in the app snapshot, but they are not selectable from the widget configuration UI yet.
When widgets do not appear in the gallery at all, the issue is almost always registration, signing, or daemon caching (not SwiftUI code).
APP="/Applications/CodexBar.app"
WAPPEX="$APP/Contents/PlugIns/CodexBarWidget.appex"
WIDGET_ID="com.steipete.codexbar.widget" # debug builds use com.steipete.codexbar.debug.widget
ls -la "$WAPPEX" "$WAPPEX/Contents" "$WAPPEX/Contents/MacOS"
pluginkit -m -p com.apple.widgetkit-extension -v | grep -i codexbar || true
pluginkit -m -p com.apple.widgetkit-extension -i "$WIDGET_ID" -vv
Notes:
+ = elected to use, - = ignored (PlugInKit elections).pluginkit -a "$WAPPEX"
pluginkit -e use -p com.apple.widgetkit-extension -i "$WIDGET_ID"
pluginkit -m -D -p com.apple.widgetkit-extension -i "$WIDGET_ID" -vv
If multiple paths appear, delete older installs and bump CFBundleVersion.
Widgets are loaded by system daemons. Any signing failure can hide the widget.
codesign --verify --deep --strict --verbose=4 /Applications/CodexBar.app
codesign --verify --strict --verbose=4 "$WAPPEX"
codesign --verify --strict --verbose=4 "$WAPPEX/Contents/MacOS/CodexBarWidget"
spctl --assess --type execute --verbose=4 /Applications/CodexBar.app
killall -9 pkd || true
sudo killall -9 chronod || true
killall Dock NotificationCenter || true
log stream --style compact --predicate '(process == "pkd" OR process == "chronod" OR subsystem CONTAINS "PlugInKit" OR subsystem CONTAINS "WidgetKit")'
com.steipete.codexbar.widget for release and com.steipete.codexbar.debug.widget for debug.NSExtensionPointIdentifier must be com.apple.widgetkit-extension.CodexBarWidget.appex.Optional: re-seed LaunchServices (rarely helps, but low risk):
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -seed
If the widget appears but always shows preview data:
See also: docs/ui.md, docs/packaging.md.