summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/Batt.hs
diff options
context:
space:
mode:
authorJens Petersen <petersen@haskell.org>2007-09-12 08:54:20 +0200
committerJens Petersen <petersen@haskell.org>2007-09-12 08:54:20 +0200
commit7d08f7256d9ebc880ed756633741d4e5e5ce6351 (patch)
tree7a9b81b5d2eaa6abddd3edf3d2be6c57a6de387d /Plugins/Monitors/Batt.hs
parentbc4d75f8f0357792ef8bb8bcb35a01ac3e7bb2fa (diff)
downloadxmobar-7d08f7256d9ebc880ed756633741d4e5e5ce6351.tar.gz
xmobar-7d08f7256d9ebc880ed756633741d4e5e5ce6351.tar.bz2
include BAT0 acpi battery status too
darcs-hash:20070912065420-740ef-41785bf4355e312f735e9c6de26649c0ef5699b0.gz
Diffstat (limited to 'Plugins/Monitors/Batt.hs')
-rw-r--r--Plugins/Monitors/Batt.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Plugins/Monitors/Batt.hs b/Plugins/Monitors/Batt.hs
index bf490f7..6a7a858 100644
--- a/Plugins/Monitors/Batt.hs
+++ b/Plugins/Monitors/Batt.hs
@@ -26,6 +26,9 @@ battConfig = mkMConfig
"Batt: <left>" -- template
["left"] -- available replacements
+fileB0 :: (String, String)
+fileB0 = ("/proc/acpi/battery/BAT0/info", "/proc/acpi/battery/BAT0/state")
+
fileB1 :: (String, String)
fileB1 = ("/proc/acpi/battery/BAT1/info", "/proc/acpi/battery/BAT1/state")
@@ -43,14 +46,16 @@ readFileBatt (i,s) =
parseBATT :: IO Batt
parseBATT =
- do (a1,b1) <- readFileBatt fileB1
+ do (a0,b0) <- readFileBatt fileB0
+ (a1,b1) <- readFileBatt fileB1
(a2,b2) <- readFileBatt fileB2
let sp p s = case stringParser p s of
[] -> 0
x -> read x
+ (f0, p0) = (sp (3,2) a0, sp (2,4) b0)
(f1, p1) = (sp (3,2) a1, sp (2,4) b1)
(f2, p2) = (sp (3,2) a2, sp (2,4) b2)
- left = (p1 + p2) / (f1 + f2) --present / full
+ left = (p0 + p1 + p2) / (f0 + f1 + f2) --present / full
return $ if isNaN left then NA else Batt left
formatBatt :: Float -> Monitor [String]