Fuller battery stats
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Returns the battery time remaining (to empty or full) in a compact format.
|
||||
|
||||
battery_info=$(upower -i $(upower -e | grep BAT))
|
||||
|
||||
echo "$battery_info" | awk '/time to (empty|full)/ {
|
||||
value = $4
|
||||
unit = $5
|
||||
gsub(/hours/, "h", unit)
|
||||
gsub(/minutes/, "m", unit)
|
||||
# Remove .0 from whole numbers
|
||||
gsub(/\.0/, "", value)
|
||||
print value unit
|
||||
exit
|
||||
}'
|
||||
Reference in New Issue
Block a user