summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-05-05 03:43:54 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-05-05 03:43:54 +0200
commit0b11325f1fb3ac81a72348c2432394233ddc5542 (patch)
treec0c96089fa03aa34bf3d15da2cd72478105e1a9e /src
parent5a0deeb636063a42b48f064b475a3899fde57c34 (diff)
downloadxmobar-0b11325f1fb3ac81a72348c2432394233ddc5542.tar.gz
xmobar-0b11325f1fb3ac81a72348c2432394233ddc5542.tar.bz2
Possible solution for coretemp files reading (github issue #38)
Apparently, temp1_label does not follow the same naming pattern as the rest of label files.
Diffstat (limited to 'src')
-rw-r--r--src/Plugins/Monitors/CoreTemp.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Plugins/Monitors/CoreTemp.hs b/src/Plugins/Monitors/CoreTemp.hs
index f7b5c95..2880751 100644
--- a/src/Plugins/Monitors/CoreTemp.hs
+++ b/src/Plugins/Monitors/CoreTemp.hs
@@ -17,6 +17,9 @@ module Plugins.Monitors.CoreTemp where
import Plugins.Monitors.Common
import Plugins.Monitors.CoreCommon
+
+import Data.Char (isDigit)
+
-- |
-- Core temperature default configuration. Default template contains only one
-- core temperature, user should specify custom template in order to get more
@@ -31,9 +34,10 @@ coreTempConfig = mkMConfig
-- Function retrieves monitor string holding the core temperature
-- (or temperatures)
runCoreTemp :: [String] -> Monitor String
-runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.", "/temp", "_input"]
- lbl = Just ("_label", read . drop 5)
+runCoreTemp _ = let path = ["/sys/bus/platform/devices/coretemp.",
+ "/temp",
+ "_input"]
+ lbl = Just ("_label", read . (dropWhile (not . isDigit)))
divisor = 1e3 :: Double
failureMessage = "CoreTemp: N/A"
in checkedDataRetrieval failureMessage path lbl (/divisor) show
-