diff options
author | Felix Springer <felixspringer149@gmail.com> | 2019-07-12 01:17:07 +0200 |
---|---|---|
committer | Felix Springer <felixspringer149@gmail.com> | 2019-07-12 01:17:07 +0200 |
commit | 4ddab0dc24abb4c812eb9b89868dbf36edf08469 (patch) | |
tree | 027d212cd0969c65c149badce6246d42e6d0ab53 /src/Xmobar | |
parent | 9d81a8f2ca61c0a5d14baa74170ac4482f6a5ee0 (diff) | |
download | xmobar-4ddab0dc24abb4c812eb9b89868dbf36edf08469.tar.gz xmobar-4ddab0dc24abb4c812eb9b89868dbf36edf08469.tar.bz2 |
display core temperatures right
Diffstat (limited to 'src/Xmobar')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/CoreTemp.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Xmobar/Plugins/Monitors/CoreTemp.hs b/src/Xmobar/Plugins/Monitors/CoreTemp.hs index 613a0cf..5588ca2 100644 --- a/src/Xmobar/Plugins/Monitors/CoreTemp.hs +++ b/src/Xmobar/Plugins/Monitors/CoreTemp.hs @@ -123,18 +123,19 @@ formatCT opts cTs = do let CTOpts { mintemp = minT domainT = maxT - minT maxCT = maximum cTs avgCT = sum cTs / (fromIntegral $ length cTs) - maxCTPc = (maxCT - minT) / domainT - avgCTPc = (avgCT - minT) / domainT + calcPc t = (t - minT) / domainT + maxCTPc = calcPc maxCT + avgCTPc = calcPc avgCT - cs <- showPercentsWithColors cTs + cs <- traverse showTempWithColors cTs - m <- showWithColors (show . (round :: Float -> Int)) maxCT + m <- showTempWithColors maxCT mp <- showWithColors' (show $ (round $ 100*maxCTPc :: Int)) maxCT mb <- showPercentBar maxCT maxCTPc mv <- showVerticalBar maxCT maxCTPc mi <- showIconPattern (loadIconPattern opts) maxCTPc - a <- showWithColors (show . (round :: Float -> Int)) avgCT + a <- showTempWithColors avgCT ap <- showWithColors' (show $ (round $ 100*avgCTPc :: Int)) avgCT ab <- showPercentBar avgCT avgCTPc av <- showVerticalBar avgCT avgCTPc @@ -144,6 +145,9 @@ formatCT opts cTs = do let CTOpts { mintemp = minT as = [ a , ap , ab , av , ai ] return (ms ++ as ++ cs) + where showTempWithColors :: Float -> Monitor String + showTempWithColors = showWithColors (show . (round :: Float -> Int)) + runCT :: [String] -> Monitor String runCT argv = do cTs <- io $ parseCT |