Skip to content

aos battery

Battery presence and charge

3 commands. Run aos battery --help for the same list from the binary, or see every group.

Battery facts for laptops. status prints the charge and whether it is charging, percent prints a bare number for scripts, and present exits 0 or 1 so a script can branch on whether there is a battery at all. On a desktop, present exits 1 and the others say no battery.

Print the charge percentage as a bare number

Terminal window
aos battery percent
Terminal window
aos battery percent # 87

Exit 0 when a battery is present, 1 otherwise

Terminal window
aos battery present
Terminal window
aos battery present && echo has a battery

Print battery charge and charging state

Terminal window
aos battery status
Terminal window
aos battery status