battery
battery copied to clipboard
Adds a simplified output mode
I use this in my lock screen script to generate the battery status on my laptop. The original text was TMI (for a lock screen) and required a fair bit of processing to extract only the information I wanted.
This change adds a trivial flag -s
which, when provided, prints out only the charge state (using unicode emoji characters) and the % charge.
$ battery
BAT0: Discharging, 47.25%, 2h33m45.7848s remaining [Voltage: 7.53V (design: 7.60V)]
$ battery -s # Discharging
🔋 47%
$ battery -s # Empty
🪫 0%
$ battery -s # Fully
🔋 100%
$ battery -s # Charging
🔌 49%