diff options
author | Norbert Zeh <nzeh@cs.dal.ca> | 2010-06-04 16:41:53 +0200 |
---|---|---|
committer | Norbert Zeh <nzeh@cs.dal.ca> | 2010-06-04 16:41:53 +0200 |
commit | 59c17dbdb1ca05f690fc47dca77ac452b0efd721 (patch) | |
tree | f659a1a966dd15921fd0524de145844ff8b446ea /Plugins/Monitors/CoreCommon.hs | |
parent | 73a3ef7912ce9c9d43d04767f06a7928087f1c51 (diff) | |
download | xmobar-59c17dbdb1ca05f690fc47dca77ac452b0efd721.tar.gz xmobar-59c17dbdb1ca05f690fc47dca77ac452b0efd721.tar.bz2 |
Fix strange formatting of CPU frequencies
Ignore-this: 8c7108dbb071318135c54f0ff830c065
This patch displays frequencies under 1GHz as MHz and above 1GHz as GHz.
Unfortunately, it was also necessary to touch CoreCommon.hs and CoreTemp.hs to
implement this.
darcs-hash:20100604144153-18a2b-cea493ec887c16a50bcef0db001ebbce3ccef74f.gz
Diffstat (limited to 'Plugins/Monitors/CoreCommon.hs')
-rw-r--r-- | Plugins/Monitors/CoreCommon.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Plugins/Monitors/CoreCommon.hs b/Plugins/Monitors/CoreCommon.hs index 95d8613..80e7700 100644 --- a/Plugins/Monitors/CoreCommon.hs +++ b/Plugins/Monitors/CoreCommon.hs @@ -27,12 +27,12 @@ import Data.List (isPrefixOf) -- is performed. checkedDataRetrieval :: (Num a, Ord a, Show a) => String -> String -> String -> String -> (Double -> a) - -> Monitor String -checkedDataRetrieval failureMessage dir file pattern trans = do + -> (a -> String) -> Monitor String +checkedDataRetrieval failureMessage dir file pattern trans fmt = do exists <- io $ fileExist $ concat [dir, "/", pattern, "0/", file] case exists of False -> return failureMessage - True -> retrieveData dir file pattern trans + True -> retrieveData dir file pattern trans fmt -- | -- Function retrieves data from files in directory dir specified by @@ -40,11 +40,12 @@ checkedDataRetrieval failureMessage dir file pattern trans = do -- to each one. Final array is processed by template parser function -- and returned as monitor string. retrieveData :: (Num a, Ord a, Show a) => - String -> String -> String -> (Double -> a) -> Monitor String -retrieveData dir file pattern trans = do + String -> String -> String -> (Double -> a) -> (a -> String) -> + Monitor String +retrieveData dir file pattern trans fmt = do count <- io $ dirCount dir pattern contents <- io $ mapM getGuts $ files count - values <- mapM (showWithColors show) $ map conversion contents + values <- mapM (showWithColors fmt) $ map conversion contents parseTemplate values where getGuts f = withFile f ReadMode hGetLine |