2024-11-04 04:37:29 +03:00
|
|
|
{ ... }: {
|
|
|
|
text = ''
|
|
|
|
# Print current battery charge level in percents.
|
|
|
|
function battery_level() {
|
|
|
|
head -c -1 /sys/class/power_supply/BAT*/capacity
|
|
|
|
echo '%'
|
|
|
|
}
|
2024-04-06 03:03:58 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
# Get battery's info.
|
|
|
|
function battery_info() {
|
|
|
|
local IFS=$'\n'
|
|
|
|
local battery=("$(upower --enumerate | grep battery_BAT)")
|
|
|
|
upower -i "''${battery[0]}"
|
|
|
|
}
|
|
|
|
'';
|
2024-04-06 03:03:58 +03:00
|
|
|
}
|