Skip to content

feat: show Disk Utility's free space and offer a meter on the Disk widget - #688

Merged
M4n0x merged 2 commits into
mainfrom
fix/686-disk-free-space-and-meter
Nov 16, 2026
Merged

M4n0x merged 2 commits into
mainfrom
fix/686-disk-free-space-and-meter

Conversation

@M4n0x

@M4n0x M4n0x commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Problem

Fixes #686. Fixes #687.

Changes

  • Free space as Disk Utility counts it (DiskMetrics.swift):
    • Every volume's free space is now volumeAvailableCapacity, the same figure df and Disk Utility show, so purgeable space counts as used.
    • diskAvailable(important:plain:) is removed, along with its fallback for volumes that report 0, because the reader no longer uses that value.
  • Wording. The popup's Available row is now Free, and the tooltip reads "67 GB free on Macintosh HD". People won't compare the number with Finder's larger Available. widgets.md, providers.md, the docs-image sample and the scene tooltips are updated to match.
  • Display choices for Disk (WidgetSettings.swift, BarInspector.swift):
    • Content → Display → Show offers Icon and value (the default, which stores no layout), Icon only, Value only and Meter and value.
    • The meter draws values.disk in the widget's warning and critical colors.
    • Graph and value is left out, because Disk keeps no history.
    • create-a-widget.md and widgets.md list the choices.
  • Scene. The new disk-meter-bar scene draws the default look and the meter at 86%, in the warning color.
  • The configuration format doesn't change.

Testing

  • swift build --build-tests passes, and swift test --filter passes for the Disk, WidgetSettings, Battery, DefaultLayout, Provider, Scene and Docs tests. I didn't run the whole suite locally; CI runs it.
  • startupDiskFreeSpaceMatchesWhatStatfsReports compares the reader with statfs("/"). Before the fix it failed on a Mac with 16.75 GB of purgeable space (83.6 GB against 66.8 GB). It passes now.
  • diskDisplayOffersMeterAndValueButNoGraph covers the choices, a round trip through each choice, and the meter's source. diskMeterTakesTheWarningState checks that the meter takes the warning state.
  • scripts/check.sh --quick and commitlint pass.
  • Not checked:
    • A live bar.
    • An external drive or network share. These now go through the same volumeAvailableCapacity read as the startup disk.

The images come from --render-scenes. The before images come from main at a2e47d3. Before this change there was no meter, so the bar scene has no before image.

Before After
Popup (Available → Free)
Settings → Content
Bar: Icon and value, then Meter and value

Merging

Use a merge commit or rebase, so the changelog gets both the fix and the feat. If you squash, the title's feat covers both.

Claude Opus 5.5 via Claude Code

The Disk widget counted purgeable space as free, like Finder's Available, so it
read 83% where Disk Utility, df and a df-based script read 86%. It now reads
volumeAvailableCapacity for every volume: purgeable space counts as used.

The popup's Available row becomes Free and the tooltip says "free on", so the
figure isn't compared with Finder's larger Available.
Battery, Sound and System monitor offer Content > Display in Settings; Disk did
not, so a progress bar needed a hand-written layout. Disk now offers Icon and
value (its default, with no layout stored), Icon only, Value only and Meter and
value. Graph and value is left out because Disk keeps no history.

The disk-meter-bar scene draws both looks in the warning colour.
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner November 16, 2026 06:24
@coderabbitai

coderabbitai Bot commented Nov 16, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The disk provider now derives free space from plain available capacity. Disk widget settings support standard, icon, value, meter, and custom displays, but not graph. Labels, documentation, tests, and sample scenes reflect the free-space definition and meter behavior.

Changes: Disk Widget

Layer / File(s) Summary
Free-space calculation
Sources/StableBar/DiskMetrics.swift, Sources/StableBar/EssentialsDetails.swift, Sources/StableBar/DocsImages.swift, Tests/StableBarTests/DiskTests.swift, docs/providers.md, docs/widgets.md, scenes/essentials-disk-popup.json, scenes/settings-disk-widget.json
Startup-volume free space now uses plain available capacity, defaults missing capacity to zero, and remains clamped between zero and total capacity. The disk details and tooltip labels use “free.” Documentation and tests describe the free-space calculation.
Disk display choices and meter
Sources/StableBar/BarInspector.swift, Sources/StableBar/WidgetSettings.swift, Tests/StableBarTests/DiskTests.swift, docs/create-a-widget.md, scenes/disk-meter-bar.json
Disk is mapped as a metric source. Disk display choices include meter and exclude graph. Tests cover the disk meter layout and warning-state styling, and a sample meter scene is added.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to dcee4

The Disk widget now reports free space the way Disk Utility and df do, and it offers a meter display option. No merge-blocking risk was found.

Pre-merge checks: Passed 3

Check name Status Explanation
Description check Passed The description follows the template well. It has Problem, Changes, Testing, and Merging sections, and it ends with the model line. It links both issues (#686 and #687) and explains the free-space fix…
Linked Issues check Passed [#686] The raw summary says SystemVolumes no longer requests volumeAvailableCapacityForImportantUsage. volume(at:session:) now reads plain volumeAvailableCapacity, clamped to the range from ze…
Out of Scope Changes check Passed Every changed file connects to #686 or #687. DiskMetrics.swift and its tests implement the free-space change. WidgetSettings.swift and BarInspector.swift implement the Display choices and the di…
Full details: Description check

Explanation

The description follows the template well. It has Problem, Changes, Testing, and Merging sections, and it ends with the model line. It links both issues (#686 and #687) and explains the free-space fix, the wording change, and the new Display choices. It gives specific test evidence, including a before-fix failure figure, and it lists what was not checked (live bar, external drive, network share). The before/after images are present, and the bar scene has no before image, which the author explains. The Merging section states which merge method the change needs. Minor gap: the Merging text does not say clearly whether a merge commit or rebase is required, but it does give a clear instruction for both cases.

Full details: Linked Issues check

Explanation

[#686] The raw summary says SystemVolumes no longer requests volumeAvailableCapacityForImportantUsage. volume(at:session:) now reads plain volumeAvailableCapacity, clamped to the range from zero through total capacity. The diskAvailable(important:plain:) reader and its zero fallback are removed. The PR description reports that startupDiskFreeSpaceMatchesWhatStatfsReports compares the reader with statfs("/"). The docs (widgets.md, providers.md) now describe purgeable space as used. These changes match the #686 expected result. I could not read the DiskMetrics.swift diff because the changed blobs were unavailable in the checkout. This finding rests on the summary and the PR description.

[#687] WidgetMetricDisplay.choices(for: "disk") returns all cases except .changes and .graph. The choices are standard (default, layout null), icon, value, meter, and custom. layout(for:) returns null for .standard when sources == ["disk"]. Icon and value map to row layouts with the icon and text blocks. The meter maps to a progress block with source set to disk, followed by the icon and text. BarInspector maps provider type disk to the disk metric source. Tests cover the choices, the round trip, and the warning state. The Custom layout entry also appears for disk. This matches the default behavior of the other sources.

Docs and scene updates support the wording and display changes.

Full details: Out of Scope Changes check

Explanation

Every changed file connects to #686 or #687. DiskMetrics.swift and its tests implement the free-space change. WidgetSettings.swift and BarInspector.swift implement the Display choices and the disk source mapping. The "Available" to "Free" wording and tooltip changes in EssentialsDetails.swift, DocsImages.swift, the scenes, and the docs follow from the #686 wording change and the updated free-space figure. create-a-widget.md and widgets.md document the new choices. scenes/disk-meter-bar.json renders the new meter choice. No unrelated behavior change appears in the summary. The DiskMetrics.swift and WidgetSettings.swift diffs were not readable directly, so this assessment relies on the summary and the readable head file for WidgetSettings.swift.

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 65c6a73 and dcee450.

Files selected for processing: 12

  • Sources/StableBar/BarInspector.swift
  • Sources/StableBar/DiskMetrics.swift
  • Sources/StableBar/DocsImages.swift
  • Sources/StableBar/EssentialsDetails.swift
  • Sources/StableBar/WidgetSettings.swift
  • Tests/StableBarTests/DiskTests.swift
  • docs/create-a-widget.md
  • docs/providers.md
  • docs/widgets.md
  • scenes/disk-meter-bar.json
  • scenes/essentials-disk-popup.json
  • scenes/settings-disk-widget.json

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Before and after

main at 65c6a73 → this pull request at dcee450 · 168 screens drawn in one CI job · 6 changed

Screen Change Where (image pixels)
docs/essentials-dark 1,453 pixels 1512,1383 · 93×21
docs/essentials-light 1,428 pixels 1512,1383 · 93×21
scenes/essentials-disk-popup-dark 1,452 pixels 80,307 · 93×21
scenes/essentials-disk-popup-light 2,059 pixels 80,277 · 94×58
scenes/settings-disk-widget-dark 519,092 pixels 502,757 · 1618×781
scenes/settings-disk-widget-light 514,064 pixels 502,757 · 1618×781

docs/essentials-dark

Before After
Before After

Difference, changed pixels in red:

Difference

docs/essentials-light

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/essentials-disk-popup-dark

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/essentials-disk-popup-light

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/settings-disk-widget-dark

Before After
Before After

Difference, changed pixels in red:

Difference

scenes/settings-disk-widget-light

Before After
Before After

Difference, changed pixels in red:

Difference

162 unchanged screens

docs/essentials-clock-settings-dark, docs/essentials-clock-settings-light, docs/essentials-settings-dark, docs/essentials-settings-light, docs/hero-dark, docs/hero-light, docs/popups-dark, docs/popups-light, docs/settings-dark, docs/settings-light, docs/themes-dark, docs/themes-light, scenes/accessibility-guide-dark, scenes/accessibility-guide-light, scenes/app-menu-popup-dark, scenes/app-menu-popup-light, scenes/apple-menu-settings-dark, scenes/apple-menu-settings-light, scenes/bottom-bar-popup-dark, scenes/bottom-bar-popup-light, scenes/chat-popup-dark, scenes/chat-popup-light, scenes/crowded-edit-bar-dark, scenes/crowded-edit-bar-light, scenes/disk-meter-bar-dark, scenes/disk-meter-bar-light, scenes/dock-badges-bar-dark, scenes/dock-badges-bar-light, scenes/edit-bar-wide-group-dark, scenes/edit-bar-wide-group-light, scenes/essentials-clock-popup-dark, scenes/essentials-clock-popup-light, scenes/filled-slider-popup-dark, scenes/filled-slider-popup-light, scenes/gruvbox-bar-dark, scenes/gruvbox-bar-light, scenes/horizontal-list-popup-dark, scenes/horizontal-list-popup-light, scenes/increase-contrast-bar-dark, scenes/increase-contrast-bar-light, scenes/increase-contrast-popup-dark, scenes/increase-contrast-popup-light, scenes/input-source-popup-dark, scenes/input-source-popup-light, scenes/notch-flare-bar-dark, scenes/notch-flare-bar-light, scenes/popup-gap-bar-dark, scenes/popup-gap-bar-light, scenes/popup-spacing-bar-dark, scenes/popup-spacing-bar-light, scenes/privacy-both-bar-dark, scenes/privacy-both-bar-light, scenes/privacy-hide-when-idle-bar-dark, scenes/privacy-hide-when-idle-bar-light, scenes/privacy-idle-bar-dark, scenes/privacy-idle-bar-light, scenes/privacy-microphone-bar-dark, scenes/privacy-microphone-bar-light, scenes/privacy-settings-dark, scenes/privacy-settings-light, scenes/reduce-transparency-bar-dark, scenes/reduce-transparency-bar-light, scenes/reduce-transparency-glass-bar-dark, scenes/reduce-transparency-glass-bar-light, scenes/settings-bar-dark, scenes/settings-bar-light, scenes/settings-bar-placement-bottom-dark, scenes/settings-bar-placement-bottom-light, scenes/settings-bar-placement-dark, scenes/settings-bar-placement-light, scenes/settings-crashes-dark, scenes/settings-crashes-light, scenes/settings-feedback-dark, scenes/settings-feedback-light, scenes/settings-general-dark, scenes/settings-general-light, scenes/settings-general-macos15-dark, scenes/settings-general-macos15-light, scenes/settings-general-move-dark, scenes/settings-general-move-failed-dark, scenes/settings-general-move-failed-light, scenes/settings-general-move-light, scenes/settings-general-move-moving-dark, scenes/settings-general-move-moving-light, scenes/settings-general-move-replace-dark, scenes/settings-general-move-replace-light, scenes/settings-general-setup-open-dark, scenes/settings-general-setup-open-light, scenes/settings-general-spaces-dark, scenes/settings-general-spaces-light, scenes/settings-help-dark, scenes/settings-help-light, scenes/settings-help-starred-dark, scenes/settings-help-starred-light, scenes/settings-narrow-dark, scenes/settings-narrow-light, scenes/settings-package-dark, scenes/settings-package-light, scenes/settings-package-widget-dark, scenes/settings-package-widget-light, scenes/settings-profiles-dark, scenes/settings-profiles-light, scenes/settings-theme-dark, scenes/settings-theme-light, scenes/settings-uninstall-dark, scenes/settings-uninstall-failed-dark, scenes/settings-uninstall-failed-light, scenes/settings-uninstall-light, scenes/settings-widget-backgrounds-dark, scenes/settings-widget-backgrounds-light, scenes/settings-workspace-hidden-dark, scenes/settings-workspace-hidden-light, scenes/setup-look-below-menu-bar-dark, scenes/setup-look-dark, scenes/setup-look-no-notch-dark, scenes/setup-move-existing-dark, scenes/setup-move-failed-dark, scenes/setup-move-ready-dark, scenes/setup-move-replace-dark, scenes/setup-omniwm-connection-dark, scenes/setup-permissions-dark, scenes/setup-permissions-spaces-dark, scenes/setup-permissions-spaces-ready-dark, scenes/setup-placement-bottom-dark, scenes/setup-placement-dark, scenes/setup-touches-dark, scenes/setup-touches-macos15-dark, scenes/setup-touches-spaces-dark, scenes/setup-try-dark, scenes/setup-yabai-connection-dark, scenes/slider-end-stop-popup-dark, scenes/slider-end-stop-popup-light, scenes/stablebar-widget-bar-dark, scenes/stablebar-widget-bar-light, scenes/stablebar-widget-settings-dark, scenes/stablebar-widget-settings-light, scenes/starter-bar-dark, scenes/starter-bar-light, scenes/starter-edit-bar-dark, scenes/starter-edit-bar-light, scenes/symbol-variants-bar-dark, scenes/symbol-variants-bar-light, scenes/system-monitor-memory-bar-dark, scenes/system-monitor-memory-bar-light, scenes/system-monitor-shows-settings-dark, scenes/system-monitor-shows-settings-light, scenes/system-monitor-split-warning-bar-dark, scenes/system-monitor-split-warning-bar-light, scenes/update-popup-dark, scenes/update-popup-light, scenes/update-popup-star-github-cli-dark, scenes/update-popup-star-github-cli-light, scenes/update-popup-star-thanks-dark, scenes/update-popup-star-thanks-light, scenes/workspace-badges-bar-dark, scenes/workspace-badges-bar-light, scenes/workspace-focused-window-bar-dark, scenes/workspace-focused-window-bar-light, scenes/workspace-focused-window-padding-bar-dark, scenes/workspace-focused-window-padding-bar-light, scenes/workspace-hidden-apps-bar-dark, scenes/workspace-hidden-apps-bar-light

Visual review: 6 changed screens approved.

@M4n0x M4n0x added the visual-ok A maintainer looked at the changed screens and approves them label Nov 16, 2026
@M4n0x
M4n0x merged commit 6c3c16b into main Nov 16, 2026
16 checks passed
@M4n0x
M4n0x deleted the fix/686-disk-free-space-and-meter branch November 16, 2026 07:28
stablebar-releases Bot pushed a commit that referenced this pull request Nov 16, 2026
## [0.16.0](v0.15.0...v0.16.0) (2026-11-16)

### Features

* add a built-in Disk widget with a popup to eject drives ([#680](#680)) by @M4n0x ([de1cb14](de1cb14)), closes [#222](#222)
* add a ring block and combine providers for compact status widgets ([#699](#699)) by @Seb-GRAF ([e05956c](e05956c))
* delete a profile from Settings → Profiles ([#668](#668)) by @M4n0x ([c2d43d4](c2d43d4)), closes [#667](#667)
* let a popup slider draw as a filled pill in the theme's colors ([#644](#644)) by @M4n0x ([f0d2f2c](f0d2f2c)), closes [#642](#642) [#642](#642)
* let a symbol fill, or take another variant, while a state is active ([#650](#650)) by @M4n0x ([b57ad13](b57ad13)), closes [#649](#649)
* match profiles to the theme the bar is drawn with ([#697](#697)) by @M4n0x ([8e98afd](8e98afd))
* open themes from stablebar links to try and install them ([#683](#683)) by @M4n0x ([b45ecee](b45ecee))
* share one padding, spacing and gap across popups ([#665](#665)) by @M4n0x ([65c6a73](65c6a73)), closes [#664](#664)
* show a menu bar item on the bar as macOS draws it ([#640](#640)) by @Jonathanm10 ([47a0286](47a0286)), closes [#639](#639)
* show Disk Utility's free space and offer a meter on the Disk widget ([#688](#688)) by @M4n0x ([6c3c16b](6c3c16b))
* undo, find and keep quotes straight when editing as JSON ([#685](#685)) by @M4n0x ([4066c68](4066c68))

### Bug Fixes

* keep a workspace switch from redrawing every widget on the bar by @M4n0x ([e5a4ebb](e5a4ebb)), closes [#670](#670)
* keep popups under the bar when their shadow reaches into the menu bar by @M4n0x ([ba2edab](ba2edab)), closes [#643](#643)
* keep the shadow margin of hover controls and trays from catching clicks on the bar ([#661](#661)) by @M4n0x ([8196fd9](8196fd9)), closes [#660](#660)
* keep the update popup on the newest release while an update waits ([#654](#654)) by @M4n0x ([8c78bd4](8c78bd4)), closes [#653](#653)
* keep workspace numbers in step with the bar's light or dark appearance ([#672](#672)) by @M4n0x ([3866e2c](3866e2c)), closes [#669](#669)
* leave Option-key alternates out of app menus ([#655](#655)) by [@amar9elbeg](https://github.com/amar9elbeg) ([f65703c](f65703c))
* open menu bar items on the bar on right-click and keep Edit Widget… on the grid symbol ([#663](#663)) by @M4n0x ([10c09ef](10c09ef)), closes [#662](#662) [#662](#662)
* reopen an app when OmniWM can't focus a window it still lists by @Jonathanm10 ([5dda2f4](5dda2f4)), closes [#651](#651)
* show a dropped workspace connection in Settings while reconnecting ([#694](#694)) by @Jonathanm10 ([f630ba8](f630ba8)), closes [#693](#693)
* stop a closed Settings window from redrawing with every bar update ([#674](#674)) by @M4n0x ([77b5383](77b5383)), closes [#671](#671)
* stop crafted tokens and settings from freezing StableBar while it loads ([#678](#678)) by @M4n0x ([435881d](435881d))
* warn only the part of a System monitor that is over its threshold ([#646](#646)) by @M4n0x ([388115b](388115b)), closes [#645](#645) [#645](#645)

### Performance Improvements

* tell whether a display has workspaces without filtering their windows by @M4n0x ([391b899](391b899))
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.16.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released visual-ok A maintainer looked at the changed screens and approves them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offer Meter and value for the Disk widget in Settings Disk widget counts purgeable space as free, so it disagrees with Disk Utility

1 participant