summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/Common.hs
diff options
context:
space:
mode:
authorsvein.ove <svein.ove@aas.no>2009-11-02 18:38:11 +0100
committersvein.ove <svein.ove@aas.no>2009-11-02 18:38:11 +0100
commit9a94be9a1f071f29e23634864f757151a7ebb03f (patch)
treef1a61eb4965036005b2b22433a80eac2adf05e27 /Plugins/Monitors/Common.hs
parent61c81eecece9ef4b3aabeb9c9bde4966d6c3ccfa (diff)
downloadxmobar-9a94be9a1f071f29e23634864f757151a7ebb03f.tar.gz
xmobar-9a94be9a1f071f29e23634864f757151a7ebb03f.tar.bz2
Since ACPI reads can be slow, use a helper /bin/cat process to perform them
Ignore-this: ae34afa8524d6cfb6baab8eb6c3a3b85 darcs-hash:20091102173811-f57bf-470bb638c0c64ddc093c2238d600772525035ea0.gz
Diffstat (limited to 'Plugins/Monitors/Common.hs')
-rw-r--r--Plugins/Monitors/Common.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index 779c6f4..caf2e98 100644
--- a/Plugins/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -43,6 +43,7 @@ module Plugins.Monitors.Common (
-- * Threaded Actions
-- $thread
, doActionTwiceWithDelay
+ , catRead
) where
@@ -56,6 +57,7 @@ import Numeric
import Text.ParserCombinators.Parsec
import System.Console.GetOpt
import Control.Exception (SomeException,handle)
+import System.Process(readProcess)
import Plugins
-- $monitor
@@ -306,3 +308,6 @@ getData action var d =
do threadDelay d
s <- action
modifyMVar_ var (\_ -> return $! s)
+
+catRead :: FilePath -> IO B.ByteString
+catRead file = B.pack `fmap` readProcess "/bin/cat" [file] ""