3 ms·
on OSX or Linux you could grep the logs every few minutes or seconds or whatever and see the battery status that includes AC power. From there you could have it
by JakeTheAndroid 7y ago
on OSX or Linux you could grep the logs every few minutes or seconds or whatever and see the battery status that includes AC power. From there you could have it alert you via whatever method you want.
On OSX:
pmset -g rawlog
Output:
$ pmset -g rawlog
pmset is in RAW logging mode now. Hit ctrl-c to exit.
* Battery matched at registry = XXXX
01/15/20 XX:XX:XX
No AC; Not Charging; 75%; Cap=5490: FCC=XXXX; Design=XXXX; Time=X:XX; -752mA; Cycles=14/1000; Location=XX;
Polled boot=01/15/20 XX:XX:XX; Full=01/15/20 XX:XX:XX; User visible=01/15/20 XX:XX:XX
I expect there are more elegant solutions, but this would theoretically work, as I used to use this among other things to track my daily laptop usage to see how on task I was any given day. If the lid is closed but unplugged then I was probably going to/in a meeting, if the lid is closed and charging then I was likely afk, not working. Worked pretty well to give me a ballpark of my productivity.