diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-19 07:40:59 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-19 07:40:59 +0200 |
commit | 737ecd4101cd40e64f576e71a99286ab8127179f (patch) | |
tree | 6423dccf62e418f710d335cb7d427f7396ceb31a /Plugins | |
parent | 2217463c0f52280835bf508dd5b768bff56f2b65 (diff) | |
download | xmobar-737ecd4101cd40e64f576e71a99286ab8127179f.tar.gz xmobar-737ecd4101cd40e64f576e71a99286ab8127179f.tar.bz2 |
oops, I forgot to add Monitors.hs (it's not possible to build xmobar without it!)
darcs-hash:20070719054059-d6583-edd071165011c9cef6a3a8c0781e5f981a9f5903.gz
Diffstat (limited to 'Plugins')
-rw-r--r-- | Plugins/Monitors.hs | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/Plugins/Monitors.hs b/Plugins/Monitors.hs new file mode 100644 index 0000000..118bacd --- /dev/null +++ b/Plugins/Monitors.hs @@ -0,0 +1,66 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Xmobar.Plugins.Monitors +-- Copyright : (c) Andrea Rossato +-- License : BSD-style (see LICENSE) +-- +-- Maintainer : Andrea Rossato <andrea.rossato@unibz.it> +-- Stability : unstable +-- Portability : unportable +-- +-- The 'Exec' class and the 'Command' data type. +-- +-- The 'Exec' class rappresents the executable types, whose constructors may +-- appear in the 'Config.commands' field of the 'Config.Config' data type. +-- +-- The 'Command' data type stores the monitors to be run internally by +-- Xmobar. +-- +----------------------------------------------------------------------------- + +module Plugins.Monitors where + +import Plugins + +import Plugins.Monitors.Common ( runM ) +import Plugins.Monitors.Weather +import Plugins.Monitors.Net +import Plugins.Monitors.Mem +import Plugins.Monitors.Swap +import Plugins.Monitors.Cpu +import Plugins.Monitors.Batt + +data Monitors = Weather Station Args Rate + | Network Interface Args Rate + | Memory Args Rate + | Swap Args Rate + | Cpu Args Rate + | Battery Args Rate + deriving (Show,Read,Eq) + +type Args = [String] +type Program = String +type Alias = String +type Station = String +type Interface = String +type Rate = Int + +instance Exec Monitors where + alias (Weather s _ _) = s + alias (Network i _ _) = i + alias (Memory _ _) = "memory" + alias (Swap _ _) = "swap" + alias (Cpu _ _) = "cpu" + alias (Battery _ _) = "battery" + rate (Weather _ _ r) = r + rate (Network _ _ r) = r + rate (Memory _ r) = r + rate (Swap _ r) = r + rate (Cpu _ r) = r + rate (Battery _ r) = r + run (Weather s a _) = runM (a ++ [s]) weatherConfig runWeather + run (Network i a _) = runM (a ++ [i]) netConfig runNet + run (Memory args _) = runM args memConfig runMem + run (Swap args _) = runM args swapConfig runSwap + run (Cpu args _) = runM args cpuConfig runCpu + run (Battery args _) = runM args battConfig runBatt |