Skip to content

Fix SMAppService helper so Performance Mode can control fans#6

Open
nsd97 wants to merge 3 commits into
idevtim:mainfrom
nsd97:contrib/helper-smaappservice
Open

Fix SMAppService helper so Performance Mode can control fans#6
nsd97 wants to merge 3 commits into
idevtim:mainfrom
nsd97:contrib/helper-smaappservice

Conversation

@nsd97

@nsd97 nsd97 commented Jul 19, 2026

Copy link
Copy Markdown

What does this PR do?

Makes Performance Mode actually drive fans by fixing SMAppService daemon packaging (BundleProgram + LaunchDaemons embed), gating UI/control on a live helper, and only caching fan targets after successful XPC — closing the “UI lies while fans stay on auto” bug.

Closes #4.

Context

What changed

  • FanControlHelper/Launchd.plist: add BundleProgramContents/Library/LaunchServices/com.idevtim.ChillMac.Helper
  • project.yml: copy plist into Contents/Library/LaunchDaemons/com.idevtim.ChillMac.Helper.plist; declare helper product as copy-script input (sandbox)
  • Gate helperReady / Performance Mode on live helper readiness; Install Helper CTA + Login Items deep link when down
  • FanControlPolicy + extract PerformanceCurve (Low→Max only); only commit target caches after successful helper reply; skip no-op @Published override writes
  • Unit tests for policy, launchd plist layout, and Max curve regression

Docs vs forums (why readiness ≠ .enabled alone)

Apple documents SMAppService.Status.enabled as registered/eligible. Forum/DTS experience: .enabled is necessary but not sufficient — the daemon can be absent and XPC can fail. This PR gates on usable helper behavior and surfaces Install / Login Items when it is not.

Review guide

Start at: FanControlHelper/Launchd.plistproject.yml (LaunchDaemons copy) → ChillMac/Fan/FanControlPolicy.swiftChillMac/App/main.swift / PopoverView Install CTA → HelperConnection error completions

How to test

  1. xcodegen generate && xcodebuild -project ChillMac.xcodeproj -scheme ChillMac -destination 'platform=macOS' test
  2. Before fix (or with helper revoked): System Settings → Login Items → turn ChillMac background item off → open popover → Performance Mode should not pretend to control fans; Install CTA visible; fan RPM stays macOS-auto
  3. After fix: tap Install Helper → approve in Login Items if prompted → enable Performance Mode → fans follow the curve (RPM moves with level/temp)
  4. Confirm helper binary still lives at Contents/Library/LaunchServices/ (intentional SMJobBless-era path; not moved to Contents/Resources)

Checklist

  • Builds without errors (xcodegen generate && xcodebuild -scheme ChillMac build)
  • Unit tests pass (xcodebuild -project ChillMac.xcodeproj -scheme ChillMac -destination 'platform=macOS' test)
  • Tested manually in the app

Made with Cursor

nsd97 and others added 3 commits July 19, 2026 10:10
Introduce PreviewSupport fixtures (no SMC/XPC in canvas), #Preview on every View, and a ChillMacTests target so previews and fixture contracts stay verifiable.

Co-authored-by: Cursor <cursoragent@cursor.com>
Register the helper with BundleProgram and LaunchDaemons layout, gate Performance Mode on a live helper with an Install CTA, and extract testable PerformanceCurve/FanControlPolicy helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid @published dictionary churn that invalidates the popover mid-update when Performance Mode re-sends the same target.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Performance Mode shows controlled fans when helper is not running

1 participant