Repository navigation
Add opt-in Apple Silicon CPU temperature sampling - #22
Conversation
fdussert
left a comment
There was a problem hiding this comment.
Thanks for splitting this out so quickly, Florian! This is very close. Everything the #16 review asked for on the server side is there: nothing is spawned while the setting is off, it is read on every poll so toggling needs no restart, the reader returns the cached value right away and refreshes in the background, execFile uses fixed paths with an argument list, a timeout and maxBuffer, stale samples are rejected both when parsing and when reading, and gpuCelsius is gone. The system channel keeps its shape, so existing tiles are unaffected. Typecheck, the full suites and the UI build pass on my side. I could not test a real reading: macmon is not installed on this machine.
A few things before merging:
-
Consent wording (
ui/src/shared/locales/{en,fr}.ts). This checkbox is consent to run a third-party program, so it should name that program and say who installs it. Something like:- en label: "Read the CPU temperature with macmon"
- en hint: "Off by default. macmon is a third-party open-source tool that Fremkit does not install; install it yourself (
brew install macmon). Once on, on Apple Silicon, the server runs /opt/homebrew/bin/macmon or /usr/local/bin/macmon every 10 seconds to take one sample. Nothing else is run and the reading stays on this Mac. Without it, the CPU tile shows the temperature macOS reports, when it reports one." - fr label: "Lire la température du CPU avec macmon"
- fr hint: "Désactivé par défaut. macmon est un outil tiers open source que Fremkit n'installe pas : installez-le vous-même (
brew install macmon). Une fois activé, sur Apple Silicon, le serveur lance /opt/homebrew/bin/macmon ou /usr/local/bin/macmon toutes les 10 secondes pour une mesure. Rien d'autre n'est lancé et la mesure reste sur ce Mac. Sans lui, la tuile CPU affiche la température que macOS fournit, quand il en fournit une."
Please also keep the new locale keys after the
claudeUsageones, in the same order as the checkboxes. -
Provider wiring (
server/src/app.ts). SwappingsystemProviderby identity inside the providers loop is easy to miss. Could you dropsystemProviderfromproviders/index.tsand registercreateSystemProvider({ ... })inapp.tsnext tocreateClaudeAccountProvider({ enabled }), with the same comment about the store living there? -
Feedback when macmon is missing or failing. The reader computes
unconfigured/offline/invalid, butsystem.tsdrops it, so someone who ticks the box without macmon installed sees nothing change and gets no hint why. An optionalcpu.tempSource: 'macmon' | 'system' | nullon the channel (backward compatible) would let the admin or the tile say so. Also, a single failed refresh currently clears the last good sample (mac-thermals.ts). Since the 30 s guard already bounds how old a sample can be, keeping the last good reading and settingerrorwould match how the other providers behave. -
CHANGELOG. The entry opens a second
### Addedunder## Unreleased. Please move it into the existing one and lead with a bold phrase like the other entries, for example: "CPU temperature from macmon. On Apple Silicon, the CPU tile can show the temperature measured by macmon, if you installed it. Turn it on under Screen → Privacy; it is off by default." -
Naming.
privacy.macThermalsonly covers the CPU, and the setting is really consent to run macmon. Something likeprivacy.macmonTemperaturewould say what it covers. We have another privacy key coming (showAccountEmail) in the same spots inschema.ts,migrate.ts,types.tsandScreenInspector.vue, so expect a small rebase depending on merge order. -
Style.
createSystemProvider's returned object was not re-indented (system.ts), and a few lines inmac-thermals.tsand in the tests are very dense. Formatting them like the rest ofserver/would help. The new migration test could also go inside the existingprivacydescribeblock. -
Commits. "Reject stale cached temperature samples" reads as a fixup of the first commit. Could you squash it and add a short body explaining the why (opt-in, background refresh, stale rejection)?
-
Docs (nice to have). A sentence in
docs/widgets.mdon how to install macmon and which two paths are tried.
Thanks again, the background refresh came out very clean!
6f9f9e7 to
cffdd63
Compare
cffdd63 to
80b2240
Compare
80b2240 to
3ae515a
Compare
|
Thanks Florian, the rebase onto #16 looks good and
Optionally: put the two locale keys after the Heads-up on merge order: #25 ( |
3ae515a to
fa2299c
Compare
|
Thanks Florian, every point is addressed and the provider reads cleanly now. Could you rebase once more onto main? #14 (Codex) landed and adds |
Keep the third-party reader inert until consent, refresh in the background, and reject expired samples without losing a recent reading on one failed refresh. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
fa2299c to
a38e3d9
Compare
fdussert
left a comment
There was a problem hiding this comment.
Thanks Florian — every point is addressed: consent wording that names macmon, the provider wired in app.ts, tempSource/tempError, no flash before the first sample, and the uptime test on createSystemProvider(). Approving. I rebased this on main myself to get it into 0.3.0: conflicts only, both sides kept, no change to your code, and you stay the author of every commit. If you push to this branch again, please git pull --rebase first. Thanks!
What changes
The CPU tile can show Apple Silicon CPU temperature measured by the optional third-party tool macmon. The Screen privacy checkbox is off by default. Fremkit does not install macmon; the user installs it separately and then enables the checkbox.
After consent, the server reads only
/opt/homebrew/bin/macmonor/usr/local/bin/macmon, requesting one background sample at most once every 10 seconds while the system channel is active. The first reading starts in a neutral state. Polling never waits for macmon. A failed refresh keeps the last good sample until it is 30 seconds old, then rejects it. The channel reportscpu.tempSourceandcpu.tempError; the CPU tile explains missing, failed, invalid or unsupported readings and uses the existing system temperature when available. Disabling consent stops subsequent macmon reads.The system provider is registered where the config store is available. The branch is rebased on the account-email privacy setting from #25 and preserves both independent switches. This PR is separate from the disk, memory, swap and uptime changes in #16.
Validation
pnpm typecheckandpnpm buildpassed after the rebase.test/app.test.tsexcluded locally because its external favicon request timed out in this environment. UI tests: 385 passed.