From 21c4c0f640c14c386d486ca9863011ef0101c367 Mon Sep 17 00:00:00 2001 From: Felix Springer Date: Sun, 14 Jul 2019 23:55:51 +0200 Subject: allow seperate icon-patterns in MultiCoreTelp --- src/Xmobar/Plugins/Monitors/MultiCoreTemp.hs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Xmobar/Plugins/Monitors/MultiCoreTemp.hs b/src/Xmobar/Plugins/Monitors/MultiCoreTemp.hs index b0325dc..90fd6d0 100644 --- a/src/Xmobar/Plugins/Monitors/MultiCoreTemp.hs +++ b/src/Xmobar/Plugins/Monitors/MultiCoreTemp.hs @@ -22,23 +22,30 @@ import System.Directory ( doesDirectoryExist ) -- | Declare Options. -data CTOpts = CTOpts { loadIconPattern :: Maybe IconPattern +data CTOpts = CTOpts { maxIconPattern :: Maybe IconPattern + , avgIconPattern :: Maybe IconPattern , mintemp :: Float , maxtemp :: Float } -- | Set default Options. defaultOpts :: CTOpts -defaultOpts = CTOpts { loadIconPattern = Nothing +defaultOpts = CTOpts { maxIconPattern = Nothing + , avgIconPattern = Nothing , mintemp = 0 , maxtemp = 100 } -- | Apply configured Options. options :: [OptDescr (CTOpts -> CTOpts)] -options = [ Option [] ["load-icon-pattern"] +options = [ Option [] ["max-icon-pattern"] (ReqArg - (\ arg opts -> opts { loadIconPattern = Just $ parseIconPattern arg }) + (\ arg opts -> opts { maxIconPattern = Just $ parseIconPattern arg }) + "") + "" + , Option [] ["avg-icon-pattern"] + (ReqArg + (\ arg opts -> opts { avgIconPattern = Just $ parseIconPattern arg }) "") "" , Option [] ["mintemp"] @@ -132,13 +139,13 @@ formatCT opts cTs = do let CTOpts { mintemp = minT mp <- showWithColors' (show (round (100*maxCTPc) :: Int)) maxCT mb <- showPercentBar maxCT maxCTPc mv <- showVerticalBar maxCT maxCTPc - mi <- showIconPattern (loadIconPattern opts) maxCTPc + mi <- showIconPattern (maxIconPattern opts) maxCTPc a <- showTempWithColors avgCT ap <- showWithColors' (show (round (100*avgCTPc) :: Int)) avgCT ab <- showPercentBar avgCT avgCTPc av <- showVerticalBar avgCT avgCTPc - ai <- showIconPattern (loadIconPattern opts) avgCTPc + ai <- showIconPattern (avgIconPattern opts) avgCTPc let ms = [ m , mp , mb , mv , mi ] as = [ a , ap , ab , av , ai ] -- cgit v1.2.3