summaryrefslogtreecommitdiffhomepage
path: root/Commands.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-18 17:12:11 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-18 17:12:11 +0200
commita8653d8712c2d218adf3f70cef7e511060bed695 (patch)
treeb463eaa897d30c41163d0e5fbee89aa946980e7f /Commands.hs
parent7235e59441c94580e99d50774629579fe54c6b1a (diff)
downloadxmobar-a8653d8712c2d218adf3f70cef7e511060bed695.tar.gz
xmobar-a8653d8712c2d218adf3f70cef7e511060bed695.tar.bz2
Monitors are now a Plugin that can be removed from Config.hs
darcs-hash:20070718151211-d6583-7e0e49c22d07feda72d03370fd592c196dfcc9c1.gz
Diffstat (limited to 'Commands.hs')
-rw-r--r--Commands.hs34
1 files changed, 0 insertions, 34 deletions
diff --git a/Commands.hs b/Commands.hs
index 61fc592..cb87521 100644
--- a/Commands.hs
+++ b/Commands.hs
@@ -24,57 +24,23 @@ import System.Process
import System.Exit
import System.IO (hClose, hGetLine)
-import Monitors.Common ( runM )
-import Monitors.Weather
-import Monitors.Net
-import Monitors.Mem
-import Monitors.Swap
-import Monitors.Cpu
-import Monitors.Batt
-
class Exec e where
run :: e -> IO String
rate :: e -> Int
alias :: e -> String
data Command = Com Program Args Alias Rate
- | 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 Command where
- alias (Weather s _ _) = s
- alias (Network i _ _) = i
- alias (Memory _ _) = "memory"
- alias (Swap _ _) = "swap"
- alias (Cpu _ _) = "cpu"
- alias (Battery _ _) = "battery"
alias (Com p _ a _) | p /= "" = if a == "" then p else a
| otherwise = ""
- rate (Weather _ _ r) = r
- rate (Network _ _ r) = r
- rate (Memory _ r) = r
- rate (Swap _ r) = r
- rate (Cpu _ r) = r
- rate (Battery _ r) = r
rate (Com _ _ _ 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
run (Com prog args _ _) = do (i,o,e,p) <- runInteractiveCommand (prog ++ concat (map (' ':) args))
exit <- waitForProcess p
let closeHandles = do hClose o