summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors/Common/Files.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-04-18 18:55:04 +0100
committerjao <jao@gnu.org>2022-04-18 18:55:04 +0100
commit552d6f8baa1048ddb5fd22269efd50b90303ca4d (patch)
treef3cd4fdf5facd76633abb99607aa438b4172def2 /src/Xmobar/Plugins/Monitors/Common/Files.hs
parent082ef98c1c265ad927b728402d8803a86bbbaeef (diff)
downloadxmobar-552d6f8baa1048ddb5fd22269efd50b90303ca4d.tar.gz
xmobar-552d6f8baa1048ddb5fd22269efd50b90303ca4d.tar.bz2
CpuFreq: new template parameters max, min and avg.
Fixes #166.
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/Common/Files.hs')
-rw-r--r--src/Xmobar/Plugins/Monitors/Common/Files.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Common/Files.hs b/src/Xmobar/Plugins/Monitors/Common/Files.hs
index b08fe6c..9f28d6b 100644
--- a/src/Xmobar/Plugins/Monitors/Common/Files.hs
+++ b/src/Xmobar/Plugins/Monitors/Common/Files.hs
@@ -14,7 +14,9 @@
--
-----------------------------------------------------------------------------
-module Xmobar.Plugins.Monitors.Common.Files (checkedDataRetrieval) where
+module Xmobar.Plugins.Monitors.Common.Files ( checkedDataRetrieval
+ , checkedDataRead)
+where
#if __GLASGOW_HASKELL__ < 800
import Control.Applicative
@@ -49,6 +51,11 @@ retrieveData path lbl trans fmt = do
=<< mapM (showWithColors fmt . trans . read) pairs
)
+checkedDataRead :: [[String]] -> Monitor [Double]
+checkedDataRead paths = concat <$> mapM readData paths
+ where readData path = map (read . snd) . sortBy (compare `on` fst) <$>
+ (mapM readFiles =<< findFilesAndLabel path Nothing)
+
-- | Represents the different types of path components
data Comp = Fix String
| Var [String]