summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors
diff options
context:
space:
mode:
Diffstat (limited to 'Plugins/Monitors')
-rw-r--r--Plugins/Monitors/CoreCommon.hs5
-rw-r--r--Plugins/Monitors/CpuFreq.hs4
2 files changed, 6 insertions, 3 deletions
diff --git a/Plugins/Monitors/CoreCommon.hs b/Plugins/Monitors/CoreCommon.hs
index 9a19cd5..d40b30a 100644
--- a/Plugins/Monitors/CoreCommon.hs
+++ b/Plugins/Monitors/CoreCommon.hs
@@ -17,6 +17,8 @@ module Plugins.Monitors.CoreCommon where
import Plugins.Monitors.Common
import System.Posix.Files (fileExist)
import System.Directory
+import Data.Char (isDigit)
+import Data.List (isPrefixOf)
-- |
-- Function checks the existence of first file specified by pattern and if the
@@ -42,7 +44,8 @@ retrieveData dir file pattern divisor = do
where
dirCount path str = getDirectoryContents path
>>= return . length
- . filter ((str ==) . take (length str))
+ . filter (\s -> str `isPrefixOf` s
+ && isDigit (last s))
files count = [ foldl (++) dir [ "/", pattern, show i, "/", file ]
| i <- [0 .. count - 1] ]
conversion = flip (/) divisor . (read :: String -> Double)
diff --git a/Plugins/Monitors/CpuFreq.hs b/Plugins/Monitors/CpuFreq.hs
index 0bd99bb..45b0c83 100644
--- a/Plugins/Monitors/CpuFreq.hs
+++ b/Plugins/Monitors/CpuFreq.hs
@@ -23,8 +23,8 @@ import Plugins.Monitors.CoreCommon
-- cpu frequencies.
cpuFreqConfig :: IO MConfig
cpuFreqConfig = mkMConfig
- "Freq: <core0>GHz" -- template
- (zipWith (++) (repeat "core") (map show [0 :: Int ..])) -- available
+ "Freq: <cpu0>GHz" -- template
+ (zipWith (++) (repeat "cpu") (map show [0 :: Int ..])) -- available
-- replacements
-- |