Built with GLM-5.1 (OpenCode) Vibe Coding.
A lightweight macOS menu bar temperature monitor for Apple Silicon (M-series chips).
- Real-time CPU / GPU temperature display in the menu bar
- Switchable CPU and GPU mode
- Color-coded temperature display (optional):
- Blue: < 35°C (Low)
- Green: 35–45°C (Normal)
- Orange: 46–55°C (High)
- Red: ≥ 56°C (Overheating)
- Icon prefix mode (optional) — colored dot ● before temperature for better visibility
- One-click open Activity Monitor
- Configurable refresh interval with presets (1s / 2s / 3s / 5s / 10s / 30s) and fine-tuning (±1s)
- Settings persistence across restarts
- Launch at login option
- English / Chinese menu language switch (defaults to English)
- No Dock icon — lives entirely in the menu bar
- macOS 13.0 (Ventura) or later
- Apple Silicon Mac (M1 / M2 / M3 / M4 series)
SwiftTempBar reads hardware temperature sensors through macOS private IOKit/HID APIs:
- IOHIDEventSystemClientCreate — creates a HID system client
- IOHIDEventSystemClientSetMatching — filters devices by
UsagePage=0xFF00, Usage=5(temperature sensors) - IOHIDEventSystemClientCopyServices — enumerates all matching sensor services
- IOHIDServiceClientCopyProperty — reads each sensor's name ("Product")
- IOHIDServiceClientCopyEvent — retrieves a temperature event (
kIOHIDEventTypeTemperature = 15) - IOHIDEventGetFloatValue — extracts the temperature value
Sensors are classified by name prefix:
- CPU:
PMU tdie,PMU tdev,pACC MTR Temp,eACC MTR Temp, etc. - GPU:
GPU MTR Temp Sensor,PMU2 tdie,PMU2 tdev, etc.
The private APIs are loaded at runtime via dlopen/dlsym — no bridging headers or ObjC needed.
Sources/
├── StatusBarController.swift # App entry (@main), menu bar UI, settings
├── TemperatureReader.swift # HID sensor reading (pure Swift)
├── Assets.xcassets/ # App icon
└── Info.plist
Only 2 Swift source files. No Storyboards, no ObjC, no dependencies.
xcodebuild -project SwiftTempBar.xcodeproj -scheme SwiftTempBar -configuration Release buildThis project was inspired by and derived from:
- SolitaryJune/TempBarApp (BSD-3)
- Cliffback/macos-temp-tool (BSD-3)
- freedomtan/sensors (BSD-3)
See LICENSE.
