From 82ce0ac834c5bd0a4a0726b897b5fbaf05d5f154 Mon Sep 17 00:00:00 2001 From: Yashar Shahi Date: Fri, 10 Mar 2017 19:53:52 +0330 Subject: [PATCH] [modules/pacman] Set thresholds Compute weighted sum and set thresholds accordingly --- bumblebee/modules/pacman.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/pacman.py b/bumblebee/modules/pacman.py index ffb1fbd..bbc615a 100644 --- a/bumblebee/modules/pacman.py +++ b/bumblebee/modules/pacman.py @@ -62,8 +62,11 @@ class Module(bumblebee.engine.Module): self._count = 0 if self._count > 300 else self._count def state(self, widget): - sumUpdates = sum(map(lambda x: widget.get(x,0), repos)) - if sumUpdates > 0: - return "critical" + weightedCount = sum(map(lambda x: (len(repos)-x[0]) * widget.get(x[1],0), enumerate(repos))) + + if weightedCount < 10: + return "good" + + return self.threshold_state(weightedCount, 100, 150) # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4