(Scripts)+script for getting time left in battery using acpi -b

Customisable and has an exact hour + minute timer.
This commit is contained in:
2024-08-19 16:29:37 +01:00
parent 927a4f96b3
commit d56aea2398
2 changed files with 12 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash
capacity=$(cat /sys/class/power_supply/BAT0/capacity) || break
status=$(cat /sys/class/power_supply/BAT0/status)
time_left=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time" | sed 's/.*://' | xargs echo $1)
time_left=$($HOME/.local/scripts/status/battery_time_left);
if [[ $status == "Charging" ]]
then

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
capture=""
if [[ $# -eq 1 ]]
then
capture="\1H,\2M,\3s"
else
capture="\1H,\2M"
fi
acpi -b | sed "s/.*\([0-9][0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/$capture/g" | xargs echo