This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/Battery.sh

13 lines
289 B
Bash

# Print current battery charge in percents.
function battery_charge() {
head -c -1 /sys/class/power_supply/BAT*/capacity
echo '%'
}
# Get battery's info.
function battery_info() {
local IFS=$'\n'
local battery=("$(upower --enumerate | grep battery_BAT)")
upower -i "${battery[0]}"
}