Fix acpi -b output check to define get_battery
This commit is contained in:
parent
41cb522d2c
commit
201ba38b2a
@ -8,21 +8,27 @@ if [ ! -d $cache_dir ]; then
|
||||
mkdir -p $cache_dir
|
||||
fi
|
||||
|
||||
if sensors 'coretemp-isa-0000' &> /dev/null; then
|
||||
if command -v sensors &> /dev/null; then
|
||||
if sensors 'coretemp-isa-0000' &> /dev/null; then
|
||||
function get_cpu_temp() {
|
||||
sensors 'coretemp-isa-0000' | awk 'NR == 3 { print substr($4, 2) }'
|
||||
}
|
||||
elif sensors 'k10temp-pci-00c3' &> /dev/null; then
|
||||
elif sensors 'k10temp-pci-00c3' &> /dev/null; then
|
||||
function get_cpu_temp {
|
||||
sensors 'k10temp-pci-00c3' | grep 'Tctl:' | awk '{ print $2 }'
|
||||
}
|
||||
else
|
||||
function get_cpu_temp {
|
||||
echo ''
|
||||
}
|
||||
fi
|
||||
else
|
||||
function get_cpu_temp {
|
||||
echo 'N/A°C'
|
||||
}
|
||||
fi
|
||||
|
||||
if [ "`acpi -b`" != "No support for device type: power_supply" ]; then
|
||||
if [[ "$(acpi -b 2>&1 /dev/null)" != "No support for device type: power_supply" ]]; then
|
||||
function get_battery {
|
||||
local output=$(acpi -b)
|
||||
local charging=$(echo $output | awk '{ print $3 }')
|
||||
|
Loading…
x
Reference in New Issue
Block a user