You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: choose CPU, memory or both in the System monitor widget - #598
The System monitor widget always shows CPU on the bar. Settings → Bar → Content → Display changes how CPU is drawn, but it can't show memory instead of CPU, or both.
Shows in Settings → Bar → Content → Display, for System monitor widgets: CPU (default), Memory, CPU and memory, Memory and CPU. Each metric gets its own symbol (cpu, memorychip) and value, and Show (icon, value, meter, graph) applies to every metric shown. Both choices write the widget's layout, as Display already did, so the configuration format doesn't change. A widget with no layout is still CPU with its graph, and existing layouts are recognized as before. While the layout is a hand-written one (Custom layout), Shows is hidden, because none of its choices matches that layout.
The system provider reports series.cpu and series.memory, the last 60 samples, kept by its native sampler (NativeMetrics, one per running source, not BarStore). The memory graph uses "source": "memory". CPU graphs keep drawing without a source, from the widget's value history, so an existing CPU graph draws exactly as before. Like the CPU baseline, the series start over after startup or resume.
Why this over the alternatives. Today the graph block can only draw the provider's value (CPU) or a series the provider sends, and system sent none. A CPU-only graph would have given memory a meter whenever Graph was chosen, so Display would mean different things for each metric. Hiding Graph for memory would have kept memory from ever getting the look that is the default for CPU. Adding the series is additive provider output, with no configuration property, and lets Display apply the same way to both.
Memory's value.fields.memory is a bare number (54), while CPU's value comes from text (18%). Memory's value is a nested row with zero spacing: {"type":"row","style":{"spacing":0},"children":[{"type":"field","field":"memory"},{"type":"text","text":"%"}]}. It draws 54% with no gap, so no provider field was added.
WidgetMetricDisplay.layout(for:) and current(_:sources:) now take the list of values shown. Battery and sound pass a single source and get the same layouts as before.
Docs: docs/providers.md (the new series), docs/create-a-widget.md (the Display paragraph), docs/widgets.md (System monitor) and docs/settings.md (what Content holds). The command line has no Display choice, so it has none for Shows either.
Scenes: system-monitor-shows-settings draws the System monitor's Content tab set to CPU and memory, Graph and value. system-monitor-memory-bar draws the default CPU widget next to a memory graph, CPU and memory meters, and memory and CPU icons and values.
Testing
swift build --build-tests; swift test --filter "WidgetSettingsTests|batteryDisplay|DefaultLayoutTests|ArchitectureRules|schemaListsTheSame|WidgetTests": all pass. testSystemStartsWithItsGraphAndKeepsIconAndValueAsAChoice now checks that every Shows × Display layout is recognized as that same pair, and that no layout means CPU with its graph.
StableBar --render-scenes from a debug build drew both new scenes. The Content tab reads Shows: CPU and memory and Show: Graph and value. On the bar, the memory graph follows series.memory, the default CPU graph is unchanged, and memory reads 54% with no gap.
scripts/check.sh --quick and npx commitlint --from origin/main pass.
The screens bot draws the before and after images from main and from this branch, including the two new scenes. Its docs/essentials-settings image changes too: it draws the System monitor's Content tab, which now has the Shows row.
Not checked: the app itself wasn't launched, so live sampling of series.memory was seen only through the scenes' sample data. The graph's line is 1.5 points in the explicit layouts, as for battery and sound, against 1.2 in CPU's default layout.
No actionable comments were generated in the recent review.
Walkthrough
The System monitor now supports CPU, memory, or both metrics in either order. Its inspector adds a Shows picker, and the system provider returns up to 60 CPU and memory history samples for graphs.
Metric display layouts now accept multiple sources. System metric choices include CPU, memory, and both orderings. Tests cover the display choices and layout matching.
CPU and memory history series Sources/StableBar/NativeMetrics.swift, docs/providers.md, scenes/system-monitor-memory-bar.json
The system provider returns the latest 60 CPU and memory fractions as series. The documentation and bar scene include the series and sample displays.
The inspector adds a Shows picker for system metrics and saves the selected layout. The settings scene and documentation show the controls.
Possibly related PRs
Seb-GRAF/StableBar#584: Adds GPU values to NativeMetrics.system(), which this change also updates to return system metric series.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 34b93
The System monitor can now show CPU, memory, or both in either order. No actionable merge-blocking risk was identified. The author reports that live memory sampling was not checked in the running app, which is normal validation uncertainty.
Security architecture risk: Minimal · up to 34b93
The change adds local CPU and memory presentation without expanding execution authority. Histories are bounded, owned by each running source and rendered through the existing graph path. No material security risk introduced or worsened by this change was identified.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The incremental data exposure is bounded aggregate history for the local host, available through existing provider consumers. State is isolated per running source, not per widget; sharing among widgets using the same named provider is pre-existing.
Trust Boundaries and Controls
observed — The new picker maps fixed enum selections to CPU and memory layouts through the existing editor.set operation. Generated blocks are presentation blocks, and a graph source is used only to select numeric samples. This path does not invoke the renderer’s separate action capability.
Resilience and Maintainability Implications
observed — Sampler mutations are MainActor-isolated. PollingSource checks cancellation before emitting, and the runner checks cancellation before accepting updates. Read failures retain the last published output; source recreation gives recovery a new sampler rather than transferring mutable history from the canceled source.
Pre-merge checks: 3
Check name
Status
Explanation
Linked Issues check
Issue #587 is the only active directly linked target. Its requirements are coding requirements. The PR meets each one, based on the whole-PR summary (mergeBase adcba36 to head 34b93d3) and the changed…
Out of Scope Changes check
Each changed area connects to #587 or supports it.
- BarInspector.swift: adds the Shows picker and derives the source list for system widgets. The picker is hidden for custom layouts. - WidgetSetting…
Description check
The description follows the template well. It has Problem (with "Closes #587"), Changes (detailed bullets explaining Shows choice, the system provider series, design alternatives, memory value layout,…
Full details: Linked Issues check
Explanation
Issue #587 is the only active directly linked target. Its requirements are coding requirements. The PR meets each one, based on the whole-PR summary (mergeBase adcba36 to head 34b93d3) and the changed-file summaries.
(1) [#587] A Shows choice for System monitor appears in Settings → Bar → Content (BarInspector.swift). Its options are CPU (default), Memory, CPU and memory, and Memory and CPU (WidgetSettings.swift, WidgetSystemMetrics). This covers the requested choice and both orders.
(2) [#587] Each shown metric gets its own symbol (cpu, memorychip) and value. Memory's value uses a nested row with zero spacing, so it reads as a percent value without a new provider field.
(3) [#587] Display applies to every shown metric. WidgetMetricDisplay.layout(for:) and current(_:sources:) now take a source list.
(4) [#587] The choice writes the widget's layout, as Display does. The configuration format is unchanged. A layout-less widget keeps CPU with its graph. Battery and sound keep their layouts.
(5) [#587] docs/widgets.md describes the choice.
Tests cover the Shows × Display round-trips (WidgetSettingsTests, BatteryTests, DefaultLayoutTests). The series.memory addition in NativeMetrics.swift supports the memory graph. The issue does not require it, but the graph depends on it. Live sampling was not verified because the app was not launched. Scene rendering used sample data. This gap does not change the verdict, because the layout behavior is covered by unit tests and scene rendering.
Full details: Out of Scope Changes check
Explanation
Each changed area connects to #587 or supports it.
BarInspector.swift: adds the Shows picker and derives the source list for system widgets. The picker is hidden for custom layouts.
WidgetSettings.swift: holds the layout and source logic and the new system selections.
NativeMetrics.swift: adds the cpu and memory series that the memory graph uses.
Test edits: update call sites for the sources-array signature and cover the new choices.
Docs (create-a-widget.md, providers.md, settings.md, widgets.md): describe the new behavior.
Scene JSON files: render the new choices for verification.
Battery and sound change only their call signatures and keep their layouts. No unrelated change appears in the summaries.
Full details: Description check
Explanation
The description follows the template well. It has Problem (with "Closes #587"), Changes (detailed bullets explaining Shows choice, the system provider series, design alternatives, memory value layout, API signature changes, docs, and scenes), Testing (build, filtered tests, scene rendering, check scripts, and an explicit list of what was not checked), and Merging (a single feat commit, any merge method works). The last line names the model and harness ("Claude Opus 5.5 via Claude Code"), as the template requires. The description is specific and matches the raw summary and PR objectives. Minor gaps: the Changes section is dense, and the Merging section does not explicitly say whether a squash would need a particular message, though it does state that any method works.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 89612fb and 34b93d3.
Files selected for processing: 4
Sources/StableBar/BarInspector.swift
Sources/StableBar/NativeMetrics.swift
docs/providers.md
docs/settings.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
## [0.14.0](v0.13.0...v0.14.0) (2026-11-12)
### Features
* add a StableBar widget that opens Settings in one click ([#599](#599)) ([c5db47a](c5db47a))
* add GPU usage to the system provider ([#584](#584)) ([afa382a](afa382a))
* build quick chats in popups with growing inputs, Markdown blocks, presets and resizing ([#573](#573)) ([fab85bd](fab85bd))
* choose CPU, memory or both in the System monitor widget ([#598](#598)) ([51d9b67](51d9b67))
* hide chosen apps and workspaces from the workspace widget ([#593](#593)) ([ce1d74b](ce1d74b))
* move StableBar to Applications from setup and pick up where setup was ([#555](#555)) ([6088f6d](6088f6d)), closes [#506](#506)
* open triage from Send feedback in the default terminal ([#568](#568)) ([71f2543](71f2543))
* place the bar at the bottom of the screen ([#594](#594)) ([e41e127](e41e127))
* show icons beside the commands in StableBar's menus ([098d61f](098d61f)), closes [#570](#570)
* show icons beside the commands in StableBar's menus ([#571](#571)) ([41b6ad0](41b6ad0)), closes [#570](#570)
* show the keyboard input source and switch it on click ([#585](#585)) ([285e3f3](285e3f3))
* show whether the microphone or camera is in use ([#592](#592)) ([3e2a1aa](3e2a1aa))
* star StableBar through a signed-in GitHub CLI from Help ([#569](#569)) ([2f09934](2f09934))
### Bug Fixes
* close Settings, setup and pinned popups with ⌘W ([#597](#597)) ([42da105](42da105))
* keep a widget's submenus open while editing the bar in place ([#583](#583)) ([d856942](d856942)), closes [#582](#582)
* leave launches dyld stopped out of Crashes and name development builds ([#577](#577)) ([09f1ab1](09f1ab1)), closes [#576](#576)
* let the Apple logo's whole tile take its click ([#575](#575)) ([913b920](913b920))
* list package settings in their manifest's order, each with a label ([#602](#602)) ([f210a21](f210a21))
* stop hover tooltips crashing StableBar after editing the bar in place ([#596](#596)) ([adcba36](adcba36))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
releasedvisual-okA maintainer looked at the changed screens and approves them
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The System monitor widget always shows CPU on the bar. Settings → Bar → Content → Display changes how CPU is drawn, but it can't show memory instead of CPU, or both.
Closes #587
Changes
cpu,memorychip) and value, and Show (icon, value, meter, graph) applies to every metric shown. Both choices write the widget'slayout, as Display already did, so the configuration format doesn't change. A widget with nolayoutis still CPU with its graph, and existing layouts are recognized as before. While the layout is a hand-written one (Custom layout), Shows is hidden, because none of its choices matches that layout.systemprovider reportsseries.cpuandseries.memory, the last 60 samples, kept by its native sampler (NativeMetrics, one per running source, notBarStore). The memory graph uses"source": "memory". CPU graphs keep drawing without asource, from the widget'svaluehistory, so an existing CPU graph draws exactly as before. Like the CPU baseline, the series start over after startup or resume.graphblock can only draw the provider'svalue(CPU) or aseriesthe provider sends, andsystemsent none. A CPU-only graph would have given memory a meter whenever Graph was chosen, so Display would mean different things for each metric. Hiding Graph for memory would have kept memory from ever getting the look that is the default for CPU. Adding the series is additive provider output, with no configuration property, and lets Display apply the same way to both.fields.memoryis a bare number (54), while CPU's value comes fromtext(18%). Memory's value is a nested row with zero spacing:{"type":"row","style":{"spacing":0},"children":[{"type":"field","field":"memory"},{"type":"text","text":"%"}]}. It draws54%with no gap, so no provider field was added.WidgetMetricDisplay.layout(for:)andcurrent(_:sources:)now take the list of values shown. Battery and sound pass a single source and get the same layouts as before.docs/providers.md(the new series),docs/create-a-widget.md(the Display paragraph),docs/widgets.md(System monitor) anddocs/settings.md(what Content holds). The command line has no Display choice, so it has none for Shows either.system-monitor-shows-settingsdraws the System monitor's Content tab set to CPU and memory, Graph and value.system-monitor-memory-bardraws the default CPU widget next to a memory graph, CPU and memory meters, and memory and CPU icons and values.Testing
swift build --build-tests;swift test --filter "WidgetSettingsTests|batteryDisplay|DefaultLayoutTests|ArchitectureRules|schemaListsTheSame|WidgetTests": all pass.testSystemStartsWithItsGraphAndKeepsIconAndValueAsAChoicenow checks that every Shows × Display layout is recognized as that same pair, and that no layout means CPU with its graph.StableBar --render-scenesfrom a debug build drew both new scenes. The Content tab reads Shows: CPU and memory and Show: Graph and value. On the bar, the memory graph followsseries.memory, the default CPU graph is unchanged, and memory reads54%with no gap.scripts/check.sh --quickandnpx commitlint --from origin/mainpass.mainand from this branch, including the two new scenes. Itsdocs/essentials-settingsimage changes too: it draws the System monitor's Content tab, which now has the Shows row.mainafter feat: add GPU usage to the system provider #584 added the GPU value:systemreportsvalues.gpuandfields.gpuas well asseries.cpuandseries.memory.series.memorywas seen only through the scenes' sample data. The graph's line is 1.5 points in the explicit layouts, as for battery and sound, against 1.2 in CPU's default layout.Merging
A single
featcommit; any merge method works.Claude Opus 5.5 via Claude Code