summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJuraj Hercek <juhe_haskell@hck.sk>2008-02-16 17:06:50 +0100
committerJuraj Hercek <juhe_haskell@hck.sk>2008-02-16 17:06:50 +0100
commit89ed90ed396988e4c37533877e1c7b936fbd4678 (patch)
tree81717a8077fcda285194f29be2aba1868a615586
parent714f7921b6539c182720dd2b0294cf3f41f8a519 (diff)
downloadxmobar-89ed90ed396988e4c37533877e1c7b936fbd4678.tar.gz
xmobar-89ed90ed396988e4c37533877e1c7b936fbd4678.tar.bz2
Adjusted filter used for digging out information from /sys directory
- As of 2.4.24 kernel you might experience same frequency for all cores, because cpufreq directory is a link for cores 1 and higher darcs-hash:20080216160650-f49a6-455bdfa46154350d723759d7175629892b284e0e.gz
-rw-r--r--Plugins/Monitors/CoreCommon.hs5
-rw-r--r--Plugins/Monitors/CpuFreq.hs4
-rw-r--r--README6
3 files changed, 9 insertions, 6 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
-- |
diff --git a/README b/README
index 42924b3..12185b6 100644
--- a/README
+++ b/README
@@ -279,10 +279,10 @@ Monitors have default aliases.
- aliases to `cpufreq`
- Args: the argument list (see below)
- Variables that can be used with the `-t`/`--template` argument:
- `core0`, `core1`, .., `coreN`
-- Default template: `Freq: <core0>GHz`
+ `cpu0`, `cpu1`, .., `cpuN`
+- Default template: `Freq: <cpu0>GHz`
- This monitor requires acpi_cpufreq module to be loaded in kernel
-- Example: Run CpuFreq ["-t","Freq:\<core0\>|\<core1\>GHz","-L","0","-H","2","-l","lightblue","-n","white","-h","red"] 50
+- Example: Run CpuFreq ["-t","Freq:\<cpu0\>|\<cpu1\>GHz","-L","0","-H","2","-l","lightblue","-n","white","-h","red"] 50
`CoreTemp Args RefreshRate`