Comment

Comment by sgt

On macOS this is elegant and efficient by listening to OS level notifications into userland. Tapping into IOKit - namely IOPowerSources and IOPSNotificationCreateRunLoopSource - is trivial and will notify you when there is a power source event.

I believe Windows has something similar - also an event.

parent sgt 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton