From 43e426d0e87aaf3aeae154064753ea89c26fe9c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Schmidts?= Date: Mon, 22 Apr 2013 23:22:32 +0200 Subject: [PATCH] add configuration options and temperature mark --- liquid.theme | 2 ++ liquidprompt | 12 +++++++----- liquidpromptrc-dist | 3 +++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/liquid.theme b/liquid.theme index 70334b5..db90580 100644 --- a/liquid.theme +++ b/liquid.theme @@ -13,6 +13,7 @@ if [[ "$(locale -k LC_CTYPE | sed -n 's/^charmap="\(.*\)"/\1/p')" == *"UTF-8"* ] LP_MARK_BATTERY="⌁" # in front of the battery charge LP_MARK_ADAPTER="⏚" # displayed when plugged LP_MARK_LOAD="⌂" # in front of the load + LP_MARK_TEMP="θ" # in front of the temp LP_MARK_PROXY="↥" # indicate a proxy in use LP_MARK_HG="☿" # prompt mark in hg repositories LP_MARK_SVN="‡" # prompt mark in svn repositories @@ -26,6 +27,7 @@ else LP_MARK_BATTERY="b" LP_MARK_ADAPTER="p" LP_MARK_LOAD="c" + LP_MARK_TEMP="T" LP_MARK_PROXY="^" LP_MARK_HG="m" LP_MARK_SVN="=" diff --git a/liquidprompt b/liquidprompt index c5315c0..8ac4e04 100755 --- a/liquidprompt +++ b/liquidprompt @@ -233,6 +233,7 @@ _lp_source_config() LP_MARK_BATTERY=${LP_MARK_BATTERY:-"⌁"} LP_MARK_ADAPTER=${LP_MARK_ADAPTER:-"⏚"} LP_MARK_LOAD=${LP_MARK_LOAD:-"⌂"} + LP_MARK_TEMP=${LP_MARK_TEMP:-"θ"} LP_MARK_PROXY=${LP_MARK_PROXY:-"↥"} LP_MARK_HG=${LP_MARK_HG:-"☿"} LP_MARK_SVN=${LP_MARK_SVN:-"‡"} @@ -1199,18 +1200,19 @@ _lp_load_color() fi } -_lp_temp() { +_lp_temperature() { [[ "$LP_ENABLE_TEMP" != 1 ]] && return + local count=0 local temperature=0 - for i in $(sensors | grep -E "Core" | - sed -e 's/.*: *+//g' -e 's/\..°.*//g'); do + for i in $(sensors | grep -E "^(Core|temp)" | + sed -r "s/.*: *\+([0-9]*)\..°.*/\1/g"); do temperature=$(($temperature+$i)) count=$(($count+1)) done temperature=$(($temperature/$count)) if [[ $temperature -ge $LP_TEMP_THRESHOLD ]]; then - echo -ne "$(_lp_color_map $temperature)$temperature°${NO_COL}" + echo -ne "$(_lp_color_map $temperature)${LP_MARK_TEMP}$temperature°${NO_COL}" fi } @@ -1396,7 +1398,7 @@ _lp_set_prompt() # left of main prompt: space at right LP_JOBS=$(_lp_sr "$(_lp_jobcount_color)") - LP_TEMP=$(_lp_sr "$(_lp_temp)") + LP_TEMP=$(_lp_sr "$(_lp_temperature)") LP_LOAD=$(_lp_sr "$(_lp_load_color)") LP_BATT=$(_lp_sr "$(_lp_battery_color)") LP_TIME=$(_lp_sr "$(_lp_time)") diff --git a/liquidpromptrc-dist b/liquidpromptrc-dist index 2677855..6029fb0 100644 --- a/liquidpromptrc-dist +++ b/liquidpromptrc-dist @@ -95,6 +95,9 @@ LP_ENABLE_BZR=1 # Recommended value is 0 LP_ENABLE_TIME=0 +# Show average system temperature +LP_ENABLE_TEMP=1 + # When showing time, use an analog clock instead of numeric values. # The analog clock is "accurate" to the nearest half hour. # You must have a unicode-capable terminal and a font with the "CLOCK"