_lp_temp_*: get result through variable instead of stdout
This commit is contained in:
parent
47d093dbe6
commit
8e2cc80a54
17
liquidprompt
17
liquidprompt
@ -1388,25 +1388,20 @@ _lp_load_color()
|
|||||||
_lp_temp_sensors()
|
_lp_temp_sensors()
|
||||||
{
|
{
|
||||||
# Return the hottest system temperature we get through the sensors command
|
# Return the hottest system temperature we get through the sensors command
|
||||||
local temperature=0
|
local i
|
||||||
for i in $(sensors |
|
for i in $(sensors |
|
||||||
sed -n -r "s/^(CPU|SYS|MB|Core|temp).*: *\+([0-9]*)\..°.*/\2/p"); do
|
sed -n -r "s/^(CPU|SYS|MB|Core|temp).*: *\+([0-9]*)\..°.*/\2/p"); do
|
||||||
if [[ $i -gt $temperature ]]; then
|
[[ $i -gt $temperature ]] && temperature=$i
|
||||||
temperature=$i
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
echo -ne "$temperature"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_lp_temp_acpi()
|
_lp_temp_acpi()
|
||||||
{
|
{
|
||||||
local temperature i
|
local i
|
||||||
temperature=0
|
|
||||||
for i in $(acpi -t | sed 's/.* \([0-9]*\)\.[0-9]* degrees C$/\1/p')
|
for i in $(acpi -t | sed 's/.* \([0-9]*\)\.[0-9]* degrees C$/\1/p')
|
||||||
do
|
do
|
||||||
(( $i > $temperature )) && temperature=$i
|
[[ $i -gt $temperature ]] && temperature=$i
|
||||||
done
|
done
|
||||||
echo -ne "$temperature"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Will set _LP_TEMP_FUNCTION so the temperature monitoring feature use an
|
# Will set _LP_TEMP_FUNCTION so the temperature monitoring feature use an
|
||||||
@ -1428,7 +1423,9 @@ _lp_temperature() {
|
|||||||
# and colorize it through _lp_color_map.
|
# and colorize it through _lp_color_map.
|
||||||
[[ "$LP_ENABLE_TEMP" != 1 ]] && return
|
[[ "$LP_ENABLE_TEMP" != 1 ]] && return
|
||||||
|
|
||||||
local temperature="$($_LP_TEMP_FUNCTION)"
|
local temperature
|
||||||
|
temperature=0
|
||||||
|
$_LP_TEMP_FUNCTION
|
||||||
if [[ $temperature -ge $LP_TEMP_THRESHOLD ]]; then
|
if [[ $temperature -ge $LP_TEMP_THRESHOLD ]]; then
|
||||||
echo -ne "${LP_MARK_TEMP}$(_lp_color_map $temperature 120)$temperature°${NO_COL}"
|
echo -ne "${LP_MARK_TEMP}$(_lp_color_map $temperature 120)$temperature°${NO_COL}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user