summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Commands.hs34
-rw-r--r--Config.hs3
-rw-r--r--Plugins/Monitors/Batt.hs (renamed from Monitors/Batt.hs)6
-rw-r--r--Plugins/Monitors/Common.hs (renamed from Monitors/Common.hs)4
-rw-r--r--Plugins/Monitors/Cpu.hs (renamed from Monitors/Cpu.hs)6
-rw-r--r--Plugins/Monitors/Mem.hs (renamed from Monitors/Mem.hs)6
-rw-r--r--Plugins/Monitors/Net.hs (renamed from Monitors/Net.hs)6
-rw-r--r--Plugins/Monitors/Swap.hs (renamed from Monitors/Swap.hs)6
-rw-r--r--Plugins/Monitors/Weather.hs (renamed from Monitors/Weather.hs)6
-rw-r--r--xmobar.cabal5
10 files changed, 25 insertions, 57 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
diff --git a/Config.hs b/Config.hs
index e21b7ff..021ee28 100644
--- a/Config.hs
+++ b/Config.hs
@@ -21,6 +21,7 @@ module Config ( -- * Configuration
import Commands
import {-# SOURCE #-} Runnable
+import Plugins.Monitors
-- $config
-- Configuration data type and default configuration
@@ -66,5 +67,5 @@ defaultConfig =
-- the 'Runnable.Runnable' Read instance. To install a plugin just add
-- the plugin's type to the list of types appearing in this function's type
-- signature.
-runnableTypes :: (Command,())
+runnableTypes :: (Command,(Monitors,()))
runnableTypes = undefined
diff --git a/Monitors/Batt.hs b/Plugins/Monitors/Batt.hs
index 57e9f6f..79c0015 100644
--- a/Monitors/Batt.hs
+++ b/Plugins/Monitors/Batt.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : Monitors.Batt
+-- Module : Plugins.Monitors.Batt
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -12,12 +12,12 @@
--
-----------------------------------------------------------------------------
-module Monitors.Batt where
+module Plugins.Monitors.Batt where
import qualified Data.ByteString.Lazy.Char8 as B
import System.Posix.Files
-import Monitors.Common
+import Plugins.Monitors.Common
battConfig :: IO MConfig
battConfig = mkMConfig
diff --git a/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index 9928946..26b6289 100644
--- a/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : Monitors.Common
+-- Module : Plugins.Monitors.Common
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -12,7 +12,7 @@
--
-----------------------------------------------------------------------------
-module Monitors.Common (
+module Plugins.Monitors.Common (
-- * Monitors
-- $monitor
Monitor
diff --git a/Monitors/Cpu.hs b/Plugins/Monitors/Cpu.hs
index 14acffb..9ab6d8f 100644
--- a/Monitors/Cpu.hs
+++ b/Plugins/Monitors/Cpu.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : Monitors.Cpu
+-- Module : Plugins.Monitors.Cpu
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -12,9 +12,9 @@
--
-----------------------------------------------------------------------------
-module Monitors.Cpu where
+module Plugins.Monitors.Cpu where
-import Monitors.Common
+import Plugins.Monitors.Common
import qualified Data.ByteString.Lazy.Char8 as B
cpuConfig :: IO MConfig
diff --git a/Monitors/Mem.hs b/Plugins/Monitors/Mem.hs
index 04e12f5..56639f2 100644
--- a/Monitors/Mem.hs
+++ b/Plugins/Monitors/Mem.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : Monitors.Mem
+-- Module : Plugins.Monitors.Mem
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -12,9 +12,9 @@
--
-----------------------------------------------------------------------------
-module Monitors.Mem where
+module Plugins.Monitors.Mem where
-import Monitors.Common
+import Plugins.Monitors.Common
memConfig :: IO MConfig
memConfig = mkMConfig
diff --git a/Monitors/Net.hs b/Plugins/Monitors/Net.hs
index 1f2343d..8534a2a 100644
--- a/Monitors/Net.hs
+++ b/Plugins/Monitors/Net.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : Monitors.Net
+-- Module : Plugins.Monitors.Net
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -12,9 +12,9 @@
--
-----------------------------------------------------------------------------
-module Monitors.Net where
+module Plugins.Monitors.Net where
-import Monitors.Common
+import Plugins.Monitors.Common
import qualified Data.ByteString.Lazy.Char8 as B
data NetDev = NA
diff --git a/Monitors/Swap.hs b/Plugins/Monitors/Swap.hs
index 5460a19..fbddaae 100644
--- a/Monitors/Swap.hs
+++ b/Plugins/Monitors/Swap.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : Monitors.Swap
+-- Module : Plugins.Monitors.Swap
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -12,9 +12,9 @@
--
-----------------------------------------------------------------------------
-module Monitors.Swap where
+module Plugins.Monitors.Swap where
-import Monitors.Common
+import Plugins.Monitors.Common
import qualified Data.ByteString.Lazy.Char8 as B
diff --git a/Monitors/Weather.hs b/Plugins/Monitors/Weather.hs
index 6a9b829..ec5606e 100644
--- a/Monitors/Weather.hs
+++ b/Plugins/Monitors/Weather.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : Monitors.Weather
+-- Module : Plugins.Monitors.Weather
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -12,9 +12,9 @@
--
-----------------------------------------------------------------------------
-module Monitors.Weather where
+module Plugins.Monitors.Weather where
-import Monitors.Common
+import Plugins.Monitors.Common
import System.Process
import System.Exit
diff --git a/xmobar.cabal b/xmobar.cabal
index 89d79c2..1dc8ec9 100644
--- a/xmobar.cabal
+++ b/xmobar.cabal
@@ -17,7 +17,8 @@ build-depends: base>=2.0, X11>=1.2.1, mtl>=1.0, unix>=1.0, parsec>=2.0, fil
executable: xmobar
main-is: Main.hs
Hs-Source-Dirs: ./
-Other-Modules: Xmobar, Config, Parsers, Commands, Runnable, Plugins, Monitors.Common, Monitors.Batt
- Monitors.Weather, Monitors.Swap, Monitors.Mem, Monitors.Cpu, Monitors.Net
+Other-Modules: Xmobar, Config, Parsers, Commands, Runnable, Plugins, Plugins.Monitors.Common,
+ Plugins.Monitors.Batt Plugins.Monitors.Weather, Plugins.Monitors.Swap,
+ Plugins.Monitors.Mem, Plugins.Monitors.Cpu, Plugins.Monitors.Net
ghc-options: -funbox-strict-fields -O2 -fasm -Wall -optl-Wl,-s -threaded
ghc-prof-options: -prof -auto-all