diff options
| author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-08 12:10:33 +0200 | 
|---|---|---|
| committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-08 12:10:33 +0200 | 
| commit | 39820c0004230f4df7e256bc83ec1c9578f94a8d (patch) | |
| tree | de263f0d05be28e81d2acb90cfb7a6ab589f93b9 /Monitors | |
| parent | c88df2b5d3cabc8e8171a422a48d0f811549f512 (diff) | |
| download | xmobar-39820c0004230f4df7e256bc83ec1c9578f94a8d.tar.gz xmobar-39820c0004230f4df7e256bc83ec1c9578f94a8d.tar.bz2 | |
monitors are now run internally
darcs-hash:20070708101033-d6583-495a895544a1fc84d4d69f52a7f26dd42b6c8af4.gz
Diffstat (limited to 'Monitors')
| -rw-r--r-- | Monitors/Batt.hs | 10 | ||||
| -rw-r--r-- | Monitors/Cpu.hs | 10 | ||||
| -rw-r--r-- | Monitors/Mem.hs | 8 | ||||
| -rw-r--r-- | Monitors/Net.hs | 13 | ||||
| -rw-r--r-- | Monitors/Swap.hs | 22 | ||||
| -rw-r--r-- | Monitors/Weather.hs | 15 | 
6 files changed, 44 insertions, 34 deletions
| diff --git a/Monitors/Batt.hs b/Monitors/Batt.hs index 5e89f9a..b3890c8 100644 --- a/Monitors/Batt.hs +++ b/Monitors/Batt.hs @@ -12,7 +12,7 @@  --  ----------------------------------------------------------------------------- -module Main where +module Monitors.Batt where  import Data.IORef  import qualified Data.ByteString.Lazy.Char8 as B @@ -20,8 +20,8 @@ import System.Posix.Files  import Monitors.Common -monitorConfig :: IO MConfig -monitorConfig =  +battConfig :: IO MConfig +battConfig =       do lc <- newIORef "#FF0000"         l <- newIORef 25         nc <- newIORef "#FF0000" @@ -79,7 +79,9 @@ runBatt _ =         l <- formatBatt c         parseTemplate l  +{-  main :: IO ()  main =      do let af = runBatt [] -       runMonitor monitorConfig af runBatt +       runMonitor battConfig af runBatt +-}
\ No newline at end of file diff --git a/Monitors/Cpu.hs b/Monitors/Cpu.hs index ed5c11e..6f9b4fd 100644 --- a/Monitors/Cpu.hs +++ b/Monitors/Cpu.hs @@ -12,14 +12,14 @@  --  ----------------------------------------------------------------------------- -module Main where +module Monitors.Cpu where  import Monitors.Common  import qualified Data.ByteString.Lazy.Char8 as B  import Data.IORef -monitorConfig :: IO MConfig -monitorConfig =  +cpuConfig :: IO MConfig +cpuConfig =       do lc <- newIORef "#BFBFBF"         l <- newIORef 2         nc <- newIORef "#00FF00" @@ -65,7 +65,9 @@ runCpu _ =         l <- formatCpu c         parseTemplate l  +{-  main :: IO ()  main =      do let af = runCpu [] -       runMonitor monitorConfig af runCpu +       runMonitor cpuConfig af runCpu +-}
\ No newline at end of file diff --git a/Monitors/Mem.hs b/Monitors/Mem.hs index 87f53b1..41f496d 100644 --- a/Monitors/Mem.hs +++ b/Monitors/Mem.hs @@ -12,14 +12,14 @@  --  ----------------------------------------------------------------------------- -module Main where +module Monitors.Mem where  import Monitors.Common  import Data.IORef -monitorConfig :: IO MConfig -monitorConfig =  +memConfig :: IO MConfig +memConfig =       do lc <- newIORef "#BFBFBF"         l <- newIORef 300         nc <- newIORef "#00FF00" @@ -59,7 +59,9 @@ runMem _ =         l <- formatMem m         parseTemplate l  +{-  main :: IO ()  main =      do let af = runMem []         runMonitor monitorConfig af runMem +-}
\ No newline at end of file diff --git a/Monitors/Net.hs b/Monitors/Net.hs index 2c7e2f0..addee47 100644 --- a/Monitors/Net.hs +++ b/Monitors/Net.hs @@ -1,6 +1,6 @@  -----------------------------------------------------------------------------  -- | --- Module      :  Monitors.Cpu +-- Module      :  Monitors.Net  -- Copyright   :  (c) Andrea Rossato  -- License     :  BSD-style (see LICENSE)  --  @@ -12,7 +12,7 @@  --  ----------------------------------------------------------------------------- -module Main where +module Monitors.Net where  import Monitors.Common @@ -28,8 +28,8 @@ data NetDev = NA  interval :: Int  interval = 500000 -monitorConfig :: IO MConfig -monitorConfig =  +netConfig :: IO MConfig +netConfig =       do lc <- newIORef "#BFBFBF"         l <- newIORef 0         nc <- newIORef "#00FF00" @@ -94,10 +94,13 @@ runNet nd =                _ -> return $ NA         printNet n +  package :: String  package = "xmb-net" +{-  main :: IO ()  main =      do let f = return "No device specified" -       runMonitor monitorConfig f runNet +       runMonitor netConfig f runNet +-}
\ No newline at end of file diff --git a/Monitors/Swap.hs b/Monitors/Swap.hs index 96b32f1..7a69341 100644 --- a/Monitors/Swap.hs +++ b/Monitors/Swap.hs @@ -12,15 +12,15 @@  --  ----------------------------------------------------------------------------- -module Main where +module Monitors.Swap where  import Monitors.Common  import Data.IORef  import qualified Data.ByteString.Lazy.Char8 as B -monitorConfig :: IO MConfig -monitorConfig =  +swapConfig :: IO MConfig +swapConfig =       do lc <- newIORef "#BFBFBF"         l <- newIORef 30         nc <- newIORef "#00FF00" @@ -44,21 +44,23 @@ parseMEM =             free = p (1,12) file         return [tot, (tot - free), free, (tot - free) / tot * 100] -formatMem :: [Float] -> Monitor [String]  -formatMem x = +formatSwap :: [Float] -> Monitor [String]  +formatSwap x =      do let f n = show (takeDigits 2 n)         mapM (showWithColors f) x  package :: String  package = "xmb-swap" -runMem :: [String] -> Monitor String -runMem _ = +runSwap :: [String] -> Monitor String +runSwap _ =      do m <- io $ parseMEM -       l <- formatMem m +       l <- formatSwap m         parseTemplate l  +{-  main :: IO ()  main = -    do let af = runMem [] -       runMonitor monitorConfig af runMem +    do let af = runSwap [] +       runMonitor swapConfig af runSwap +-}
\ No newline at end of file diff --git a/Monitors/Weather.hs b/Monitors/Weather.hs index 2d957bd..63eb48e 100644 --- a/Monitors/Weather.hs +++ b/Monitors/Weather.hs @@ -12,7 +12,7 @@  --  ----------------------------------------------------------------------------- -module Main where +module Monitors.Weather where  import Monitors.Common @@ -25,8 +25,8 @@ import System.IO  import Text.ParserCombinators.Parsec -monitorConfig :: IO MConfig -monitorConfig =  +weatherConfig :: IO MConfig +weatherConfig =       do lc <- newIORef "#BFBFBF"         l <- newIORef 15         nc <- newIORef "#00FF00" @@ -53,8 +53,7 @@ monitorConfig =                       ]         return $ MC nc l lc h hc t p u a e - -data WeatherInfo =  +data WeatherInfo =      WI { stationPlace :: String         , stationState :: String         , year :: String @@ -70,8 +69,6 @@ data WeatherInfo =         , pressure :: String         } deriving (Show) - -  pTime :: Parser (String, String, String, String)  pTime = do y <- getNumbersAsString             char '.' @@ -147,7 +144,9 @@ runWeather str =  package :: String  package = "xmb-weather" +{-  main :: IO ()  main =      do let af = return "No station ID specified" -       runMonitor monitorConfig af runWeather +       runMonitor weatherConfig af runWeather +-}
\ No newline at end of file | 
