Skip to content

Expand Mac system metrics and uptime tiles - #16

Merged
fdussert merged 2 commits into
fdussert:mainfrom
FlorianBruniaux:codex/system-metrics
Oct 15, 2026
Merged

fdussert merged 2 commits into
fdussert:mainfrom
FlorianBruniaux:codex/system-metrics

Conversation

@FlorianBruniaux

@FlorianBruniaux FlorianBruniaux commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What changes

The built-in system channel reports boot uptime, APFS-aware available disk space, available RAM and swap. The disk tile shows the startup disk's usable capacity without the sealed system volume's misleading 14 GB figure; the memory tile exposes available RAM and swap. A new Uptime tile shows time since the last boot. No third-party tool is needed.

The history has two commits: system channel with disk/memory tiles, then the Uptime tile. Optional macmon temperature sampling is separate in #22.

Validation

  • pnpm typecheck
  • pnpm test (1,387 server tests and 385 UI tests after rebase on current main)
  • pnpm build
  • Isolated render of the 16×4 disk tile with five volumes: first row remains reachable and the content scrolls.

This branch was not installed on the live Edge. No real hardware temperature reading is claimed here.

@fdussert fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this, Florian! It's a solid contribution. The disk fix is a real improvement: on current main the Mac disk reads the sealed system volume (about 14 GB "used"), and picking /System/Volumes/Data gives the number people expect. The macmon reader is careful: fixed paths, execFile with an argument list, a timeout and maxBuffer, coalesced calls, a freshness check on the sample, and no made-up temperature when there is no sensor. A failed reading never takes the other metrics down with it, and the tests cover all of that. The uptime tile also belongs in core: it works on any Mac with nothing to install. Typecheck and the full test suite pass on my side.

Could you split this into two PRs?

  • (a) Disk, RAM, swap and uptime on the system channel, the disk and memory tiles, and the uptime tile. This is plain macOS with nothing to install, and once the points below are fixed it should go in quickly. One commit per concern inside it would be ideal (system channel + disk/memory tiles, then the uptime tile).
  • (b) macmon temperatures, as a separate PR, opt-in.

Running a third-party binary the user never pointed Fremkit at, even from fixed paths and even read-only, is something the core should only do when asked. Please put it behind an explicit setting (a checkbox in the admin, in the spirit of privacy.claudeAccountUsage), off by default, so nothing is spawned until the user turns it on.

For (a):

  1. Disk tile layout regression (widgets/disk/index.html). At the default 16×4 size (160 px) with three volumes, the bars vanish: in a flex column with overflow-y:auto, the .bar elements shrink to 0 height. The third volume is also clipped. On main, three volumes fit. The bold 24 px "N GB available" line under each volume roughly doubles the height of each row. Could the available space go into the existing muted row instead (for example "698 GB / 926 GB · 140 GB free"), with the centred layout kept? On APFS, several volumes in the same container also repeat the same free space, which is another reason to keep it compact.

  2. Disk numbers. On the Data volume, used counts only that volume while size is the whole container, so "698 GB / 926 GB" plus "140 GB available" doesn't add up. For the Mac disk, reporting used = size - available would be consistent. Note also that df/statfs leave out purgeable space, so the value will be lower than Finder's. A line in the docs would avoid surprises.

  3. Uptime widget conventions (widgets/uptime/index.html). The frame already draws the tile title, so the widget should not draw its own "Uptime" heading and icon. Text written straight into the HTML is also against the "no text in the HTML" rule in docs/writing-widgets.md. Please use var(--accent, #d9b36a) instead of the hard-coded teal, and add html.accent-fill rules so the note stays readable on an accent body. Formatting the CSS and JS like the other built-in widgets would make the tile much easier to maintain.

  4. Manifests. Please keep widgets/disk/manifest.json and widgets/memory/manifest.json in their original compact format and change only the version line. widgets/uptime/manifest.json declares min 8×3 and default 16×4 while docs/widgets.md says 8×4 and 8×4, so please align them.

  5. CHANGELOG. The new Uptime tile needs its own line, written for the person using Fremkit rather than in terms of the system channel. Please match the style of the existing entries (bold lead phrase). Several other open PRs also add lines under ## Unreleased, so expect a small rebase depending on merge order.

  6. Style. normalizeDisks and the new tests are tightly packed; formatting them like the rest of server/ would help.

For (b), on top of the opt-in:

  1. Polling cost (mac-thermals.ts). When the cache expires, poll() waits for macmon to sample (about 500 ms, and up to the 4 s timeout if it hangs), and that holds back the whole system channel (CPU, RAM, disks). Could the reader refresh in the background and always return the cached value right away?

  2. gpuCelsius isn't shown by any tile yet. Either show it or leave it out for now.

Thanks again! The disk and memory improvements are very welcome.

@fdussert

Copy link
Copy Markdown
Owner

Thanks for the quick turnaround, Florian! This is much better: macmon is out, the disk tile keeps its bars with three volumes at 16×4, the Mac disk numbers add up, and the Uptime tile follows the widget conventions. Typecheck and the full suite pass on my side.

A few things left before merging:

  1. Conflict with main. CHANGELOG.md conflicts since Add service marks to built-in widgets #21 landed. Please rebase on main.
  2. History. While rebasing, could you squash into two commits, each with a short body: (1) system channel + disk/memory tiles, (2) the Uptime tile? Right now the first commit still adds mac-thermals.ts and reformats the manifests, and a later commit removes them, so the macmon code would stay in the history.
  3. docs/widgets.md, cpu section. The rewritten cpu paragraph ("No temperature is estimated from CPU load") is left over from the macmon part. Please restore the original line.
  4. Disk tile. .wrap still has overflow-y:auto together with justify-content:center. With five volumes, the first row goes above the top edge and can't be scrolled back into view. Dropping overflow-y:auto (or using justify-content:safe center) avoids that. The .big font-size change is unused and can go.
  5. Formatting. server/test/uptime-widget.test.ts is still minified, normalizeDisks has lines over 100 characters, and the new L entries in disk/memory are packed (free:{fr:…}). Formatting them like the surrounding code would be great.

Thanks again, nearly there!

@fdussert fdussert left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Florian — everything from the follow-up is in: two clean commits, no macmon left, the cpu docs restored, and the five-volume case now scrolls cleanly. Merging. Could you drop the macmon paragraph (and the old test count) from the PR description for the record?

@fdussert

Copy link
Copy Markdown
Owner

Sorry Florian — #15 landed a minute before this one and the two now conflict (most likely the CHANGELOG.md lines under ### Added). Could you rebase on main once more? It's approved, so I'll merge it as soon as it's clean.

FlorianBruniaux and others added 2 commits October 15, 2026 18:03
Normalize APFS Data volume capacity, expose free RAM and swap, and publish a guarded uptime reading on the system channel for future tiles.

Co-Authored-By: Claude <noreply@anthropic.com>
Display the guarded system-channel reading with explicit loading, unavailable and stale states, and document the new tile.

Co-Authored-By: Claude <noreply@anthropic.com>
@fdussert
fdussert merged commit d0f3e45 into fdussert:main Oct 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants