HN 표시: Mac이 충전하는 동안 배터리가 소모되는 시기 확인
hackernews
|
|
💼 비즈니스
#macos
#swiftui
#개발팁
#메뉴바앱
#배터리
원문 출처: hackernews · Genesis Park에서 요약 및 분석
요약
오랜 비행 도안 USB 전원만 사용하는 상황에서 Mac이 충전 속도보다 빠르게 방전되는지 확인하기 위해 개발자가 메뉴 바 앱을 직접 제작했습니다. 단일 Swift 파일과 IOKit 기반 이벤트 구동으로 설계되어 CPU 사용량은 거의 없으면서도 실시간 전력 소모량을 보여주고, 충전이 따라가지 못할 때 경고를 보냅니다. 덕분에 개발자는 자신의 충전기가 충분한 전력을 공급하지 못하고 있다는 사실을 발견했습니다.
본문
I was on a flight that only had a USB power outlet, and I didn't know whether I was drawing more power than I was receiving. So I built this. A single-file SwiftUI menu bar app for macOS. Event-driven via IOKit — near-zero CPU when idle. git clone https://github.com/jlreyes/PowerMonitor.git cd PowerMonitor make install open -a ~ /.local/bin/PowerMonitor.app To remove: Registers an IOPSNotificationCreateRunLoopSource callback that fires on any power source change Reads AppleSmartBattery via IOKit for voltage, amperage, charging state If ExternalConnected == true && InstantAmperage < 0 — you're draining while plugged in Sends a native macOS notification (5-min cooldown) when this happens Menu bar states Icon Meaning ⚡ 9W Plugged in, charging at 9W into battery ⚠ 5W Plugged in, draining at 5W (charger can't keep up) 63% On battery MIT
Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.
공유