summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Plugins/Monitors/Batt.hs2
-rw-r--r--Plugins/Monitors/Common.hs9
-rw-r--r--Plugins/Monitors/Cpu.hs8
-rw-r--r--Plugins/Monitors/Mem.hs2
-rw-r--r--Plugins/Monitors/MultiCpu.hs2
-rw-r--r--Plugins/Monitors/Swap.hs2
-rw-r--r--README89
7 files changed, 66 insertions, 48 deletions
diff --git a/Plugins/Monitors/Batt.hs b/Plugins/Monitors/Batt.hs
index 16af6da..547dd02 100644
--- a/Plugins/Monitors/Batt.hs
+++ b/Plugins/Monitors/Batt.hs
@@ -23,7 +23,7 @@ data Batt = Batt Float String
battConfig :: IO MConfig
battConfig = mkMConfig
- "Batt: <left>" -- template
+ "Batt: <left>%" -- template
["leftbar", "left", "status"] -- available replacements
type File = (String, String)
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index 637dbd9..9f1db3c 100644
--- a/Plugins/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -130,7 +130,7 @@ mkMConfig tmpl exprts =
bb <- newIORef ":"
bf <- newIORef "#"
bw <- newIORef 10
- up <- newIORef True
+ up <- newIORef False
return $ MC nc l lc h hc t e p mn mx pc pr bb bf bw up
data Opts = HighColor String
@@ -184,7 +184,7 @@ doConfigOptions [] = io $ return ()
doConfigOptions (o:oo) =
do let next = doConfigOptions oo
nz s = let x = read s in max 0 x
- bool s = s == "True"
+ bool = (`elem` ["True", "true", "Yes", "yes", "On", "on"])
case o of
High h -> setConfigValue (read h) high >> next
Low l -> setConfigValue (read l) low >> next
@@ -198,13 +198,14 @@ doConfigOptions (o:oo) =
Width w -> setConfigValue (nz w) minWidth >>
setConfigValue (nz w) maxWidth >> next
PadChars pc -> setConfigValue pc padChars >> next
- PadAlign pa -> setConfigValue (isPrefixOf "r" pa) padRight >> next
+ PadAlign a -> setConfigValue ("r" `isPrefixOf` a) padRight >> next
BarBack bb -> setConfigValue bb barBack >> next
BarFore bf -> setConfigValue bf barFore >> next
BarWidth bw -> setConfigValue (nz bw) barWidth >> next
UsePercent up -> setConfigValue (bool up) usePercent >> next
-runM :: [String] -> IO MConfig -> ([String] -> Monitor String) -> Int -> (String -> IO ()) -> IO ()
+runM :: [String] -> IO MConfig -> ([String] -> Monitor String) -> Int
+ -> (String -> IO ()) -> IO ()
runM args conf action r cb = go
where go = do
c <- conf
diff --git a/Plugins/Monitors/Cpu.hs b/Plugins/Monitors/Cpu.hs
index d94bd0f..78e3ec7 100644
--- a/Plugins/Monitors/Cpu.hs
+++ b/Plugins/Monitors/Cpu.hs
@@ -19,8 +19,8 @@ import qualified Data.ByteString.Lazy.Char8 as B
cpuConfig :: IO MConfig
cpuConfig = mkMConfig
- "Cpu: <total>" -- template
- ["bar","total","user","nice","system","idle"] -- available replacements
+ "Cpu: <total>%"
+ ["bar","total","user","nice","system","idle"]
cpuData :: IO [Float]
cpuData = do s <- B.readFile "/proc/stat"
@@ -28,7 +28,7 @@ cpuData = do s <- B.readFile "/proc/stat"
cpuParser :: B.ByteString -> [Float]
cpuParser =
- map read . map B.unpack . tail . B.words . flip (!!) 0 . B.lines
+ map (read . B.unpack) . tail . B.words . flip (!!) 0 . B.lines
parseCPU :: IO [Float]
parseCPU =
@@ -48,6 +48,6 @@ formatCpu xs = do
runCpu :: [String] -> Monitor String
runCpu _ =
- do c <- io $ parseCPU
+ do c <- io parseCPU
l <- formatCpu c
parseTemplate l
diff --git a/Plugins/Monitors/Mem.hs b/Plugins/Monitors/Mem.hs
index e1ea5de..a55d58e 100644
--- a/Plugins/Monitors/Mem.hs
+++ b/Plugins/Monitors/Mem.hs
@@ -18,7 +18,7 @@ import Plugins.Monitors.Common
memConfig :: IO MConfig
memConfig = mkMConfig
- "Mem: <usedratio> (<cache>M)" -- template
+ "Mem: <usedratio>% (<cache>M)" -- template
["usedbar", "freebar", "usedratio", "total",
"free", "buffer", "cache", "rest", "used"] -- available replacements
diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs
index 223ff24..069199b 100644
--- a/Plugins/Monitors/MultiCpu.hs
+++ b/Plugins/Monitors/MultiCpu.hs
@@ -20,7 +20,7 @@ import Data.List (isPrefixOf)
multiCpuConfig :: IO MConfig
multiCpuConfig =
- mkMConfig "Cpu: <total>"
+ mkMConfig "Cpu: <total>%"
[ k ++ n | n <- "" : map show [0 :: Int ..]
, k <- ["bar","total","user","nice","system","idle"]]
diff --git a/Plugins/Monitors/Swap.hs b/Plugins/Monitors/Swap.hs
index 8901a2a..d2e6077 100644
--- a/Plugins/Monitors/Swap.hs
+++ b/Plugins/Monitors/Swap.hs
@@ -20,7 +20,7 @@ import qualified Data.ByteString.Lazy.Char8 as B
swapConfig :: IO MConfig
swapConfig = mkMConfig
- "Swap: <usedratio>" -- template
+ "Swap: <usedratio>%" -- template
["usedratio", "total", "used", "free"] -- available replacements
fileMEM :: IO B.ByteString
diff --git a/README b/README
index ac76ac6..adfe32c 100644
--- a/README
+++ b/README
@@ -92,7 +92,8 @@ Otherwise, you'll need to install them yourself.
`with_inotify`
: Support for inotify in modern linux kernels. This option is needed
- for the MBox and Mail plugins to work.
+ for the MBox and Mail plugins to work. Requires the [hinotify]
+ package.
`with_iwlib`
: Support for wireless cards. Enables the Wireless plugin. No Haskell
@@ -334,10 +335,9 @@ Monitors have default aliases.
- Variables that can be used with the `-t`/`--template` argument:
`essid`, `quality`, `qualitybar`
- Default template: `<essid> <quality>`
-- Requires the C library libiw (part of the wireless tools suite)
+- Requires the C library [libiw] (part of the wireless tools suite)
installed in your system. In addition, to activate this plugin you
- must pass --flags="with_iwlib" to "runhaskell Setup configure"
- or to "cabal install".
+ must pass `--flags="with_iwlib"` during compilation.
`Memory Args RefreshRate`
@@ -362,7 +362,7 @@ Monitors have default aliases.
- Args: the argument list (see below)
- Variables that can be used with the `-t`/`--template` argument:
`total`, `bar`, `user`, `nice`, `system`, `idle`
-- Default template: `Cpu: <total>`
+- Default template: `Cpu: <total>%`
`MultiCpu Args RefreshRate`
@@ -371,7 +371,7 @@ Monitors have default aliases.
- Variables that can be used with the `-t`/`--template` argument:
`total`, `bar`, `user`, `nice`, `system`, `idle`,
`total0`, `bar0`, `user0`, `nice0`, `system0`, `idle0`, ...
-- Default template: `Cpu: <total>`
+- Default template: `Cpu: <total>%`
`Battery Args RefreshRate`
@@ -391,7 +391,7 @@ Monitors have default aliases.
- Args: the argument list (see below)
- Variables that can be used with the `-t`/`--template` argument:
`left`, `leftbar`, `status`
-- Default template: `Batt: <left>`
+- Default template: `Batt: <left>%`
`TopProc Args RefreshRate`
@@ -423,20 +423,26 @@ Monitors have default aliases.
- Disks: list of pairs of the form (device or mount point, template),
where the template can contain <size>, <free>, <used>, <freep> or
<usedp>, <freebar> or <usedbar> for total, free, used, free
- percentage and used percentage of the given file system capacity. Example:
- `[("/", "<used>/<size>"), ("sdb1", "<usedbar>")]`
+ percentage and used percentage of the given file system capacity.
- Args: the argument list (see above). `-t`/`--template` is ignored.
- Default template: none (you must specify a template for each file system).
+- Example:
+
+ DiskU [("/", "<used>/<size>"), ("sdb1", "<usedbar>")]
+ ["-L", "20", "-H", "50", "-m", "1", "-p", "3",]
+ 20
`DiskIO Disks Args RefreshRate`
- aliases to `diskio`
- Disks: list of pairs of the form (device or mount point, template),
where the template can contain <total>, <read>, <write> for total,
- read and write speed, respectively. Example:
- `[("/", "<read> <write>"), ("sdb1", "<total>")]`
+ read and write speed, respectively.
- Args: the argument list (see above). `-t`/`--template` is ignored.
- Default template: none (you must specify a template for each file system).
+- Example:
+
+ Disks [("/", "<read> <write>"), ("sdb1", "<total>")] [] 10
`Thermal Zone Args RefreshRate`
@@ -447,7 +453,9 @@ Monitors have default aliases.
- Default template: `Thm: <temp>C`
- This plugin works only on sytems with devices having thermal zone.
Check directories in /proc/acpi/thermal_zone for possible values.
-- Example: `Run Thermal "THRM" ["-t","iwl4965-temp: <temp>C"]`
+- Example:
+
+ Run Thermal "THRM" ["-t","iwl4965-temp: <temp>C"]
`CpuFreq Args RefreshRate`
@@ -457,7 +465,10 @@ Monitors have default aliases.
`cpu0`, `cpu1`, .., `cpuN`
- Default template: `Freq: <cpu0>GHz`
- This monitor requires acpi_cpufreq module to be loaded in kernel
-- Example: `Run CpuFreq ["-t","Freq:<cpu0>|<cpu1>GHz","-L","0","-H","2","-l","lightblue","-n","white","-h","red"] 50`
+- Example:
+
+ Run CpuFreq ["-t", "Freq:<cpu0>|<cpu1>GHz", "-L", "0", "-H", "2",
+ "-l", "lightblue", "-n","white", "-h", "red"] 50
`CoreTemp Args RefreshRate`
@@ -467,10 +478,16 @@ Monitors have default aliases.
`core0`, `core1`, .., `coreN`
- Default template: `Temp: <core0>C`
- This monitor requires coretemp module to be loaded in kernel
-- Example: `Run CoreTemp ["-t","Temp:<core0>|<core1>C","-L","40","-H","60","-l","lightblue","-n","gray90","-h","red"] 50`
+- Example:
+
+ Run CoreTemp ["-t", "Temp:<core0>|<core1>C",
+ "-L", "40", "-H", "60",
+ "-l", "lightblue", "-n", "gray90", "-h", "red"] 50
`MPD Args RefreshRate`
+- This monitor will only be compiled if you ask for it using the
+ `with_mpd` flag. It needs [libmpd] 5.0 or later (available on Hackage).
- aliases to `mpd`
- Args: the argument list (see below). In addition you can provide
`-P`, `-S` and `-Z`, with an string argument, to represent the
@@ -484,26 +501,24 @@ Monitors have default aliases.
`name`, `artist`, `composer`, `performer`
`album`, `title`, `track`, `file`, `genre`
- Default template: `MPD: <state>`
-- Example:
- `Run MPD ["-t",
- "<composer> <title> (<album>) <track>/<plength> <statei> ",
- "--", "-P", ">>", "-Z", "|", "-S", "><"] 10`
- Note that you need "--" to separate regular monitor options from
- MPD's specific ones.
-- This monitor will only be compiled if you ask for it using the
- `with_mpd` flag. It needs libmpd 4.1 or later (available on Hackage).
+- Example (note that you need "--" to separate regular monitor options from
+ MPD's specific ones):
+
+ Run MPD ["-t",
+ "<composer> <title> (<album>) <track>/<plength> <statei> ",
+ "--", "-P", ">>", "-Z", "|", "-S", "><"] 10
`Mail Args`
- aliases to `Mail`
-- Args: list of maildirs in form [("name1","path1"),("name2","path2")]
-- This plugin requires INOTIFY support in Linux kernel and hinotify library.
- To activate, pass --flags="with_inotify" to "runhaskell Setup configure"
- or to "cabal install".
+- Args: list of maildirs in form `[("name1","path1"),("name2","path2")]`
+- This plugin requires inotify support in your linux kernel and the
+ [hinotify] package. To activate, pass `--flags="with_inotify"`
+ during compilation.
`MBox Mboxes Opts Alias`
-- Mboxes a list of mbox files of the form [("name", "path", "color")],
+- Mboxes a list of mbox files of the form `[("name", "path", "color")]`,
where name is the displayed name, path the absolute or relative (to
BaseDir) path of the mbox file, and color the color to use to display
the mail count (use an empty string for the default).
@@ -515,15 +530,16 @@ Monitors have default aliases.
of displayed mail coints
-s suffix --suffix suffix a string giving a suffix for the list
of displayed mail coints
-- This plugin requires INOTIFY support in Linux kernel and hinotify library.
- To activate, pass --flags="with_inotify" to "runhaskell Setup
- configure" or to "cabal install".
-- Example:
- `Run MBox [("I ", "inbox", "red"), ("O ", "/foo/mbox", "")]
- ["-d", "/var/mail/", "-p", " "] "mbox"`
- will look for mails in `/var/mail/inbox` and `/foo/mbox`, and will put
- a space in front of the printed string (when it's not empty); it
- can be used in the template with the alias `mbox`.
+- This plugin requires inotify support in your linux kernel and the
+ [hinotify] package. To activate, pass `--flags="with_inotify"`
+ during compilation.
+- Example. The following command look for mails in `/var/mail/inbox`
+ and `/foo/mbox`, and will put a space in front of the printed string
+ (when it's not empty); it can be used in the template with the alias
+ `mbox`:
+
+ Run MBox [("I ", "inbox", "red"), ("O ", "/foo/mbox", "")]
+ ["-d", "/var/mail/", "-p", " "] "mbox"
## Monitor Plugins Commands Arguments
@@ -785,6 +801,7 @@ Copyright &copy; 2010 Jose Antonio Ortega Ruiz
[X11-xft]: http://hackage.haskell.org/package/X11-xft/
[i3status]: http://i3.zekjur.net/i3status/
[iwlib]: http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
+[hinotify]: http://hackage.haskell.org/package/hinotify/
[libmpd]: http://hackage.haskell.org/package/libmpd/
[sawfish]: http://sawfish.wikia.com/
[utf8-string]: http://hackage.haskell.org/package/utf8-string/