update plugin documentation
This commit is contained in:
19
plugins/available/battery.plugin.bash
Normal file → Executable file
19
plugins/available/battery.plugin.bash
Normal file → Executable file
@@ -1,11 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cite about-plugin
|
||||
about-plugin query and display info about your battery charge level
|
||||
|
||||
battery_percentage(){
|
||||
about 'displays battery charge as a percentage of full (100%)'
|
||||
group battery
|
||||
|
||||
if command_exists acpi;
|
||||
then
|
||||
local ACPI_OUTPUT=$(acpi -b)
|
||||
case $ACPI_OUTPUT in
|
||||
*" Unknown"*)
|
||||
*" Unknown"*)
|
||||
local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 22 | tail -c 2)
|
||||
case $PERC_OUTPUT in
|
||||
*%)
|
||||
@@ -16,7 +22,7 @@ battery_percentage(){
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*" Discharging"*)
|
||||
*" Discharging"*)
|
||||
local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 26 | tail -c 2)
|
||||
case $PERC_OUTPUT in
|
||||
*%)
|
||||
@@ -27,7 +33,7 @@ battery_percentage(){
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*" Charging"*)
|
||||
*" Charging"*)
|
||||
local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 23 | tail -c 2)
|
||||
case $PERC_OUTPUT in
|
||||
*%)
|
||||
@@ -38,7 +44,7 @@ battery_percentage(){
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*" Full"*)
|
||||
*" Full"*)
|
||||
echo '99'
|
||||
;;
|
||||
*)
|
||||
@@ -52,7 +58,7 @@ battery_percentage(){
|
||||
#local IOREG_OUTPUT_10_5=$(ioreg -l | grep -i capacity | grep -v Legacy| tr '\n' ' | ' | awk '{printf("%.2f%%", $14/$7 * 100)}')
|
||||
local IOREG_OUTPUT=$(ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}')
|
||||
case $IOREG_OUTPUT in
|
||||
100*)
|
||||
100*)
|
||||
echo '99'
|
||||
;;
|
||||
*)
|
||||
@@ -65,6 +71,9 @@ battery_percentage(){
|
||||
}
|
||||
|
||||
battery_charge(){
|
||||
about graphical display of your battery charge
|
||||
group battery
|
||||
|
||||
# Full char
|
||||
local F_C='▸'
|
||||
# Depleted char
|
||||
|
||||
Reference in New Issue
Block a user