How to programmatically get your current battery level using COCOA

How can I get the current battery level using the cocoa frame working with Leopard?

I am currently running NSTask with:

pmset -g ps | grep -o -e [0-9]*% | sed -e 's/%//g' 

But I think this is a clumsy way to do this.

thanks

+4
source share
2 answers

I believe this question was asked here earlier ... Here are some links:

Battery Status on OSX? (set here earlier)

He limited my number of links because I am new ... but you should find more links there

+5
source

Source: https://habr.com/ru/post/1286550/


All Articles