From f634a9441889c3642f7bfcf73cf737b931a5808f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Thu, 5 Dec 2013 00:00:38 +0100 Subject: [PATCH] Temperature/Linux: fetch using "acpi -t" --- liquidprompt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/liquidprompt b/liquidprompt index d538008..98592d8 100755 --- a/liquidprompt +++ b/liquidprompt @@ -1385,7 +1385,8 @@ _lp_load_color() # System temperature # ###################### -_lp_temp_sensors() { +_lp_temp_sensors() +{ # Return the hottest system temperature we get through the sensors command local temperature=0 for i in $(sensors | @@ -1397,10 +1398,17 @@ _lp_temp_sensors() { echo -ne "$temperature" } +_lp_temp_acpi() +{ + expr "$(acpi -t)" : '.* \([0-9]*\)\.[0-9]* degrees C' +} + # Will set _LP_TEMP_FUNCTION so the temperature monitoring feature use an # available command. _LP_TEMP_FUNCTION should return only a numeric value if [[ "$LP_ENABLE_TEMP" = 1 ]]; then - if command -v sensors >/dev/null; then + if command -v acpi >/dev/null; then + _LP_TEMP_FUNCTION=_lp_temp_acpi + elif command -v sensors >/dev/null; then _LP_TEMP_FUNCTION=_lp_temp_sensors # elif command -v the_command_you_want_to_use; then # _LP_TEMP_FUNCTION=your_function