From 8192d59284a2701bfde43c48079a4f1991b3ddc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20Silkeb=C3=A6kken?= Date: Mon, 21 Jan 2013 11:46:14 +0100 Subject: [PATCH] Make system load thresholds customizable --- powerline/segments/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powerline/segments/common.py b/powerline/segments/common.py index eeb01a6c..e9654dac 100644 --- a/powerline/segments/common.py +++ b/powerline/segments/common.py @@ -118,13 +118,13 @@ def weather(unit='c', location_query=None): return u'{0} {1}°{2}'.format(icon, condition['temp'], unit.upper()) -def system_load(format='{avg[0]:.1f}, {avg[1]:.1f}, {avg[2]:.1f}'): +def system_load(format='{avg[0]:.1f}, {avg[1]:.1f}, {avg[2]:.1f}', threshold_good=1, threshold_bad=2): from multiprocessing import cpu_count averages = os.getloadavg() normalized = averages[1] / cpu_count() - if normalized < 1: + if normalized < threshold_good: gradient = 'system_load_good' - elif normalized < 2: + elif normalized < threshold_bad: gradient = 'system_load_bad' else: gradient = 'system_load_ugly'