summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar
diff options
context:
space:
mode:
authorSibi Prabakaran <sibi@psibi.in>2020-06-14 15:40:18 +0530
committerjao <jao@gnu.org>2020-06-23 16:38:20 +0100
commit8aec308ae2030f8bff7bc58ec435b8a610951d0a (patch)
tree75224696b25a4926388afe57c5555713038b923d /src/Xmobar
parent505615b7fab38ba81fda92e0fba5b3d59cecc948 (diff)
downloadxmobar-8aec308ae2030f8bff7bc58ec435b8a610951d0a.tar.gz
xmobar-8aec308ae2030f8bff7bc58ec435b8a610951d0a.tar.bz2
Cleanup and add some tests
Diffstat (limited to 'src/Xmobar')
-rw-r--r--src/Xmobar/Plugins/Monitors/Cpu.hs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Cpu.hs b/src/Xmobar/Plugins/Monitors/Cpu.hs
index f234dcf..02d2949 100644
--- a/src/Xmobar/Plugins/Monitors/Cpu.hs
+++ b/src/Xmobar/Plugins/Monitors/Cpu.hs
@@ -138,12 +138,6 @@ parseCpu cref =
percent = map safeDiv dif
return $ convertToCpuData percent
-conditionalCompute :: [String] -> String -> IO String -> IO String
-conditionalCompute allFields field action = if field `elem` allFields
- then action
- else pure []
-
-
data Field = Field {
fieldName :: !String,
fieldCompute :: !ShouldCompute
@@ -187,8 +181,8 @@ computeFields (x:xs) inputFields =
else (Field {fieldName = x, fieldCompute = Skip}) : (computeFields xs inputFields)
formatCpu :: CpuArguments -> CpuData -> IO [String]
-formatCpu args@CpuArguments{..} cpuData = do
- strs <- mapM (formatField cpuParams cpuOpts cpuData) cpuFields
+formatCpu CpuArguments{..} cpuInfo = do
+ strs <- mapM (formatField cpuParams cpuOpts cpuInfo) cpuFields
pure $ filter (not . null) strs
getInputFields :: CpuArguments -> [String]
@@ -214,7 +208,7 @@ getArguments :: [String] -> IO CpuArguments
getArguments cpuArgs = do
initCpuData <- cpuData
cpuDataRef <- newIORef initCpuData
- cpuData <- parseCpu cpuDataRef
+ void $ parseCpu cpuDataRef
cpuParams <- computePureConfig cpuArgs cpuConfig
cpuInputTemplate <- runTemplateParser cpuParams
cpuAllTemplate <- runExportParser (pExport cpuParams)