summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlexander Shabalin <shabalyn.a@gmail.com>2014-09-24 12:31:54 +0400
committerAlexander Shabalin <shabalyn.a@gmail.com>2014-09-24 12:31:54 +0400
commitf8b7b22253d72b7b6ecf83bac87a8cda41040f49 (patch)
tree38705b1e87c9f8e7a74d8f2de502fec2c7de1725
parente26731b1fc292a16230f6517aa292dd3973929ae (diff)
downloadxmobar-f8b7b22253d72b7b6ecf83bac87a8cda41040f49.tar.gz
xmobar-f8b7b22253d72b7b6ecf83bac87a8cda41040f49.tar.bz2
Rename dynamic string to icon pattern
-rw-r--r--readme.md94
-rw-r--r--src/Plugins/Monitors/Batt.hs36
-rw-r--r--src/Plugins/Monitors/Bright.hs12
-rw-r--r--src/Plugins/Monitors/Common.hs26
-rw-r--r--src/Plugins/Monitors/Cpu.hs12
-rw-r--r--src/Plugins/Monitors/Disk.hs58
-rw-r--r--src/Plugins/Monitors/MPD.hs14
-rw-r--r--src/Plugins/Monitors/Mem.hs24
-rw-r--r--src/Plugins/Monitors/MultiCpu.hs24
-rw-r--r--src/Plugins/Monitors/Net.hs32
-rw-r--r--src/Plugins/Monitors/Volume.hs20
-rw-r--r--src/Plugins/Monitors/Wireless.hs14
12 files changed, 183 insertions, 183 deletions
diff --git a/readme.md b/readme.md
index cb3b9cc..003ee2a 100644
--- a/readme.md
+++ b/readme.md
@@ -542,7 +542,7 @@ Monitors have default aliases. The sections below describe every
monitor in turn, but before we provide a list of the configuration
options (or *monitor arguments*) they all share.
-### Dynamic Strings
+### Icon patterns
Some monitors allow usage of strings that depend on some integer value
from 0 to 8 by replacing all occurences of `"%%"` with it
@@ -552,9 +552,9 @@ as `"%"`, `"%%"` as `"3"`, `"%%%"` as `"3%"`, `"%%%%"` as `"33"` and so on). Ess
it allows to replace vertical bars with custom icons. For example,
Run Brightness
- [ "-t", "<dstr>"
+ [ "-t", "<ipat>"
, "--"
- , "--brightness-dynamic-string", "<icon=bright_%%.xpm/>"
+ , "--brightness-icon-pattern", "<icon=bright_%%.xpm/>"
] 30
Will display `bright_0.xpm` to `bright_8.xpm` depending on current brightness
@@ -711,11 +711,11 @@ something like:
- Aliases to the interface name: so `Network "eth0" []` can be used as
`%eth0%`
- Args: default monitor arguments, plus:
- - `--rx-dynamic-string`: dynamic string for reception rate in `rxdstr`.
- - `--tx-dynamic-string`: dynamic string for transmission rate in `txdstr`.
+ - `--rx-icon-pattern`: dynamic string for reception rate in `rxipat`.
+ - `--tx-icon-pattern`: dynamic string for transmission rate in `txipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `dev`, `rx`, `tx`, `rxbar`, `rxvbar`, `rxdstr`, `txbar`, `txvbar`,
- `txdstr`. Reception and transmission rates (`rx` and `tx`) are displayed
+ `dev`, `rx`, `tx`, `rxbar`, `rxvbar`, `rxipat`, `txbar`, `txvbar`,
+ `txipat`. Reception and transmission rates (`rx` and `tx`) are displayed
by default as Kb/s, without any suffixes, but you can set the `-S` to
"True" to make them displayed with adaptive units (Kb/s, Mb/s, etc.).
- Default template: `<dev>: <rx>KB|<tx>KB`
@@ -725,11 +725,11 @@ something like:
- Active interface is detected automatically
- Aliases to "dynnetwork"
- Args: default monitor arguments, plus:
- - `--rx-dynamic-string`: dynamic string for reception rate in `rxdstr`.
- - `--tx-dynamic-string`: dynamic string for transmission rate in `txdstr`.
+ - `--rx-icon-pattern`: dynamic string for reception rate in `rxipat`.
+ - `--tx-icon-pattern`: dynamic string for transmission rate in `txipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `dev`, `rx`, `tx`, `rxbar`, `rxvbar`, `rxdstr`, `txbar`, `txvbar`,
- `txdstr`. Reception and transmission rates (`rx` and `tx`) are displayed
+ `dev`, `rx`, `tx`, `rxbar`, `rxvbar`, `rxipat`, `txbar`, `txvbar`,
+ `txipat`. Reception and transmission rates (`rx` and `tx`) are displayed
in Kbytes per second, and you can set the `-S` to "True" to make them
displayed with units (the string "Kb/s").
- Default template: `<dev>: <rx>KB|<tx>KB`
@@ -739,9 +739,9 @@ something like:
- Aliases to the interface name with the suffix "wi": thus, `Wireless
"wlan0" []` can be used as `%wlan0wi%`
- Args: default monitor arguments, plus:
- - `--quality-dynamic-string`: dynamic string for connection quality in `qualitydstr`.
+ - `--quality-icon-pattern`: dynamic string for connection quality in `qualityipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `essid`, `quality`, `qualitybar`, `qualityvbar`, `qualitydstr`
+ `essid`, `quality`, `qualitybar`, `qualityvbar`, `qualityipat`
- Default template: `<essid> <quality>`
- Requires the C library [iwlib] (part of the wireless tools suite)
installed in your system. In addition, to activate this plugin you
@@ -751,12 +751,12 @@ something like:
- Aliases to `memory`
- Args: default monitor arguments, plus:
- - `--used-dynamic-string`: dynamic string for used memory ratio in `useddstr`.
- - `--free-dynamic-string`: dynamic string for free memory ratio in `freedstr`.
+ - `--used-icon-pattern`: dynamic string for used memory ratio in `usedipat`.
+ - `--free-icon-pattern`: dynamic string for free memory ratio in `freeipat`.
- Variables that can be used with the `-t`/`--template` argument:
`total`, `free`, `buffer`, `cache`, `rest`, `used`,
- `usedratio`, `usedbar`, `usedvbar`, `useddstr`,
- `freeratio`, `freebar`, `freevbar`, `freedstr`
+ `usedratio`, `usedbar`, `usedvbar`, `usedipat`,
+ `freeratio`, `freebar`, `freevbar`, `freeipat`
- Default template: `Mem: <usedratio>% (<cache>M)`
### `Swap Args RefreshRate`
@@ -771,23 +771,23 @@ something like:
- Aliases to `cpu`
- Args: default monitor arguments, plus:
- - `--load-dynamic-string`: dynamic string for cpu load in `dstr`.
+ - `--load-icon-pattern`: dynamic string for cpu load in `ipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `total`, `bar`, `vbar`, `dstr`, `user`, `nice`, `system`, `idle`, `iowait`
+ `total`, `bar`, `vbar`, `ipat`, `user`, `nice`, `system`, `idle`, `iowait`
- Default template: `Cpu: <total>%`
### `MultiCpu Args RefreshRate`
- Aliases to `multicpu`
- Args: default monitor arguments, plus:
- - `--load-dynamic-string`: dynamic string for overall cpu load in `dstr`.
- - `--load-dynamic-strings`: dynamic string for each cpu load in `autodstr`, `dstr{i}`.
+ - `--load-icon-pattern`: dynamic string for overall cpu load in `ipat`.
+ - `--load-icon-patterns`: dynamic string for each cpu load in `autoipat`, `ipat{i}`.
This option can be specified several times. nth option
corresponds to nth cpu.
- Variables that can be used with the `-t`/`--template` argument:
- `autototal`, `autobar`, `autovbar`, `autodstr`, `autouser`, `autonice`,
- `autosystem`, `autoidle`, `total`, `bar`, `vbar`, `dstr`, `user`, `nice`,
- `system`, `idle`, `total0`, `bar0`, `vbar0`, `dstr0`, `user0`, `nice0`,
+ `autototal`, `autobar`, `autovbar`, `autoipat`, `autouser`, `autonice`,
+ `autosystem`, `autoidle`, `total`, `bar`, `vbar`, `ipat`, `user`, `nice`,
+ `system`, `idle`, `total0`, `bar0`, `vbar0`, `ipat0`, `user0`, `nice0`,
`system0`, `idle0`, ...
The auto* variables automatically detect the number of CPUs on the system
and display one entry for each.
@@ -818,15 +818,15 @@ something like:
- `-p`: color to display positive power (battery charging)
- `-f`: file in `/sys/class/power_supply` with AC info (default:
"AC/online")
- - `--on-dynamic-string`: dynamic string for current battery charge
- when AC is "on" in `leftdstr`.
- - `--off-dynamic-string`: dynamic string for current battery charge
- when AC is "off" in `leftdstr`.
- - `--idle-dynamic-string`: dynamic string for current battery charge
- when AC is "idle" in `leftdstr`.
+ - `--on-icon-pattern`: dynamic string for current battery charge
+ when AC is "on" in `leftipat`.
+ - `--off-icon-pattern`: dynamic string for current battery charge
+ when AC is "off" in `leftipat`.
+ - `--idle-icon-pattern`: dynamic string for current battery charge
+ when AC is "idle" in `leftipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `left`, `leftbar`, `leftvbar`, `leftdstr`, `timeleft`, `watts`, `acstatus`
+ `left`, `leftbar`, `leftvbar`, `leftipat`, `timeleft`, `watts`, `acstatus`
- Default template: `Batt: <watts>, <left>% / <timeleft>`
- Example (note that you need "--" to separate regular monitor options from
Battery's specific ones):
@@ -899,12 +899,12 @@ more than one battery.
- Aliases to `disku`
- Disks: list of pairs of the form (device or mount point, template),
where the template can contain `<size>`, `<free>`, `<used>`, `<freep>` or
- `<usedp>`, `<freebar>`, `<freevbar>`, `<freedstr>`, `<usedbar>`,
- `<usedvbar>` or `<useddstr>` for total, free, used, free percentage and
+ `<usedp>`, `<freebar>`, `<freevbar>`, `<freeipat>`, `<usedbar>`,
+ `<usedvbar>` or `<usedipat>` for total, free, used, free percentage and
used percentage of the given file system capacity.
- Args: default monitor arguments. `-t`/`--template` is ignored. Plus
- - `--free-dynamic-string`: dynamic string for free disk space in `freedstr`.
- - `--used-dynamic-string`: dynamic string for used disk space in `useddstr`.
+ - `--free-icon-pattern`: dynamic string for free disk space in `freeipat`.
+ - `--used-icon-pattern`: dynamic string for used disk space in `usedipat`.
- Default template: none (you must specify a template for each file system).
- Example:
@@ -918,13 +918,13 @@ more than one battery.
- 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. There are also bar versions of each:
- `<totalbar>`, `<totalvbar>`, `<totaldstr>`,
- `<readbar>`, `<readvbar>`, `<readdstr>`,
- `<writebar>`, `<writevbar>`, and `<writedstr>`.
+ `<totalbar>`, `<totalvbar>`, `<totalipat>`,
+ `<readbar>`, `<readvbar>`, `<readipat>`,
+ `<writebar>`, `<writevbar>`, and `<writeipat>`.
- Args: default monitor arguments. `-t`/`--template` is ignored. Plus
- - `--total-dynamic-string`: dynamic string for total disk I/O in `<totaldstr>`.
- - `--write-dynamic-string`: dynamic string for write disk I/O in `<writedstr>`.
- - `--read-dynamic-string`: dynamic string for read disk I/O in `<readdstr>`.
+ - `--total-icon-pattern`: dynamic string for total disk I/O in `<totalipat>`.
+ - `--write-icon-pattern`: dynamic string for write disk I/O in `<writeipat>`.
+ - `--read-icon-pattern`: dynamic string for read disk I/O in `<readipat>`.
- Default template: none (you must specify a template for each file system).
- Example:
@@ -1012,9 +1012,9 @@ more than one battery.
- Long option: `--offc`
- `--highd` _number_ High threshold for dB. Defaults to -5.0.
- `--lowd` _number_ Low threshold for dB. Defaults to -30.0.
- - `--volume-dynamic-string` _string_ dynamic string for current volume in `volumedstr`.
+ - `--volume-icon-pattern` _string_ dynamic string for current volume in `volumeipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `volume`, `volumebar`, `volumevbar`, `volumedstr`, `dB`, `status`
+ `volume`, `volumebar`, `volumevbar`, `volumeipat`, `dB`, `status`
- Note that `dB` might only return 0 on your system. This is known
to happen on systems with a pulseaudio backend.
- Default template: `Vol: <volume>% <status>`
@@ -1032,9 +1032,9 @@ more than one battery.
playing, stopped and paused states in the `statei` template field.
The environment variables `MPD_HOST` and `MPD_PORT` are used to configure the
mpd server to communicate with. Also available:
- - `lapsed-dynamic-string`: dynamic string for current track position in `dstr`.
+ - `lapsed-icon-pattern`: dynamic string for current track position in `ipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `bar`, `vbar`, `dstr`, `state`, `statei`, `volume`, `length`,
+ `bar`, `vbar`, `ipat`, `state`, `statei`, `volume`, `length`,
`lapsed`, `remaining`,
`plength` (playlist length), `ppos` (playlist position),
`name`, `artist`, `composer`, `performer`,
@@ -1154,9 +1154,9 @@ more than one battery.
actual_brightness)
- `-M`: file with the maximum brightness (default:
max_brightness)
- - `--brightness-dynamic-string`: dynamic string for current brightness in `dstr`.
+ - `--brightness-icon-pattern`: dynamic string for current brightness in `ipat`.
- Variables that can be used with the `-t`/`--template` argument:
- `vbar`, `percent`, `bar`, `dstr`
+ `vbar`, `percent`, `bar`, `ipat`
- Default template: `<percent>`
- Example:
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs
index 592deae..f7b31e4 100644
--- a/src/Plugins/Monitors/Batt.hs
+++ b/src/Plugins/Monitors/Batt.hs
@@ -34,9 +34,9 @@ data BattOpts = BattOpts
, highThreshold :: Float
, onlineFile :: FilePath
, scale :: Float
- , onDynamicString :: Maybe DynamicString
- , offDynamicString :: Maybe DynamicString
- , idleDynamicString :: Maybe DynamicString
+ , onIconPattern :: Maybe IconPattern
+ , offIconPattern :: Maybe IconPattern
+ , idleIconPattern :: Maybe IconPattern
}
defaultOpts :: BattOpts
@@ -52,9 +52,9 @@ defaultOpts = BattOpts
, highThreshold = -10
, onlineFile = "AC/online"
, scale = 1e6
- , onDynamicString = Nothing
- , offDynamicString = Nothing
- , idleDynamicString = Nothing
+ , onIconPattern = Nothing
+ , offIconPattern = Nothing
+ , idleIconPattern = Nothing
}
options :: [OptDescr (BattOpts -> BattOpts)]
@@ -70,12 +70,12 @@ options =
, Option "H" ["hight"] (ReqArg (\x o -> o { highThreshold = read x }) "") ""
, Option "f" ["online"] (ReqArg (\x o -> o { onlineFile = x }) "") ""
, Option "s" ["scale"] (ReqArg (\x o -> o {scale = read x}) "") ""
- , Option "" ["on-dynamic-string"] (ReqArg (\x o ->
- o { onDynamicString = Just $ parseDynamicString x }) "") ""
- , Option "" ["off-dynamic-string"] (ReqArg (\x o ->
- o { offDynamicString = Just $ parseDynamicString x }) "") ""
- , Option "" ["idle-dynamic-string"] (ReqArg (\x o ->
- o { idleDynamicString = Just $ parseDynamicString x }) "") ""
+ , Option "" ["on-icon-pattern"] (ReqArg (\x o ->
+ o { onIconPattern = Just $ parseIconPattern x }) "") ""
+ , Option "" ["off-icon-pattern"] (ReqArg (\x o ->
+ o { offIconPattern = Just $ parseIconPattern x }) "") ""
+ , Option "" ["idle-icon-pattern"] (ReqArg (\x o ->
+ o { idleIconPattern = Just $ parseIconPattern x }) "") ""
]
parseOpts :: [String] -> IO BattOpts
@@ -94,7 +94,7 @@ sysDir = "/sys/class/power_supply"
battConfig :: IO MConfig
battConfig = mkMConfig
"Batt: <watts>, <left>% / <timeleft>" -- template
- ["leftbar", "leftvbar", "left", "acstatus", "timeleft", "watts", "leftdstr"] -- replacements
+ ["leftbar", "leftvbar", "left", "acstatus", "timeleft", "watts", "leftipat"] -- replacements
data Files = Files
{ fFull :: String
@@ -182,7 +182,7 @@ runBatt' bfs args = do
Result x w t s ->
do l <- fmtPercent x
ws <- fmtWatts w opts suffix d
- si <- getDynamicString opts s x
+ si <- getIconPattern opts s x
parseTemplate (l ++ [fmtStatus opts s, fmtTime $ floor t, ws, si])
NA -> getConfigValue naString
where fmtPercent :: Float -> Monitor [String]
@@ -209,9 +209,9 @@ runBatt' bfs args = do
| -x >= highThreshold o = maybeColor (highWColor o)
| -x >= lowThreshold o = maybeColor (mediumWColor o)
| otherwise = maybeColor (lowWColor o)
- getDynamicString opts status x = do
+ getIconPattern opts status x = do
let x' = minimum [1, x]
case status of
- Idle -> showDynamicString (idleDynamicString opts) x'
- Charging -> showDynamicString (onDynamicString opts) x'
- Discharging -> showDynamicString (offDynamicString opts) x'
+ Idle -> showIconPattern (idleIconPattern opts) x'
+ Charging -> showIconPattern (onIconPattern opts) x'
+ Discharging -> showIconPattern (offIconPattern opts) x'
diff --git a/src/Plugins/Monitors/Bright.hs b/src/Plugins/Monitors/Bright.hs
index 999b459..cb510f6 100644
--- a/src/Plugins/Monitors/Bright.hs
+++ b/src/Plugins/Monitors/Bright.hs
@@ -26,22 +26,22 @@ import Plugins.Monitors.Common
data BrightOpts = BrightOpts { subDir :: String
, currBright :: String
, maxBright :: String
- , curBrightDynamicString :: Maybe DynamicString
+ , curBrightIconPattern :: Maybe IconPattern
}
defaultOpts :: BrightOpts
defaultOpts = BrightOpts { subDir = "acpi_video0"
, currBright = "actual_brightness"
, maxBright = "max_brightness"
- , curBrightDynamicString = Nothing
+ , curBrightIconPattern = Nothing
}
options :: [OptDescr (BrightOpts -> BrightOpts)]
options = [ Option "D" ["device"] (ReqArg (\x o -> o { subDir = x }) "") ""
, Option "C" ["curr"] (ReqArg (\x o -> o { currBright = x }) "") ""
, Option "M" ["max"] (ReqArg (\x o -> o { maxBright = x }) "") ""
- , Option "" ["brightness-dynamic-string"] (ReqArg (\x o ->
- o { curBrightDynamicString = Just $ parseDynamicString x }) "") ""
+ , Option "" ["brightness-icon-pattern"] (ReqArg (\x o ->
+ o { curBrightIconPattern = Just $ parseIconPattern x }) "") ""
]
-- from Batt.hs
@@ -56,7 +56,7 @@ sysDir = "/sys/class/backlight/"
brightConfig :: IO MConfig
brightConfig = mkMConfig "<percent>" -- template
- ["vbar", "percent", "bar", "dstr"] -- replacements
+ ["vbar", "percent", "bar", "ipat"] -- replacements
data Files = Files { fCurr :: String
, fMax :: String
@@ -85,7 +85,7 @@ runBright args = do
fmtPercent opts c = do r <- showVerticalBar (100 * c) c
s <- showPercentWithColors c
t <- showPercentBar (100 * c) c
- d <- showDynamicString (curBrightDynamicString opts) c
+ d <- showIconPattern (curBrightIconPattern opts) c
return [r,s,t,d]
readBright :: Files -> IO Float
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs
index ed91c73..7d11258 100644
--- a/src/Plugins/Monitors/Common.hs
+++ b/src/Plugins/Monitors/Common.hs
@@ -40,8 +40,8 @@ module Plugins.Monitors.Common (
, parseTemplate'
-- ** String Manipulation
-- $strings
- , DynamicString
- , parseDynamicString
+ , IconPattern
+ , parseIconPattern
, padString
, showWithPadding
, showWithColors
@@ -50,10 +50,10 @@ module Plugins.Monitors.Common (
, showPercentsWithColors
, showPercentBar
, showVerticalBar
- , showDynamicString
+ , showIconPattern
, showLogBar
, showLogVBar
- , showLogDynamicString
+ , showLogIconPattern
, showWithUnits
, takeDigits
, showDigits
@@ -352,10 +352,10 @@ combine m ((s,ts,ss):xs) =
-- $strings
-type DynamicString = Int -> String
+type IconPattern = Int -> String
-parseDynamicString :: String -> DynamicString
-parseDynamicString path =
+parseIconPattern :: String -> IconPattern
+parseIconPattern path =
let spl = splitOnPercent path
in \i -> concat $ intersperse (show i) spl
where splitOnPercent [] = [[]]
@@ -469,9 +469,9 @@ showPercentBar v x = do
s <- colorizeString v (take len $ cycle bf)
return $ s ++ take (bw - len) (cycle bb)
-showDynamicString :: Maybe DynamicString -> Float -> Monitor String
-showDynamicString Nothing _ = return ""
-showDynamicString (Just str) x = return $ str $ convert $ 100 * x
+showIconPattern :: Maybe IconPattern -> Float -> Monitor String
+showIconPattern Nothing _ = return ""
+showIconPattern (Just str) x = return $ str $ convert $ 100 * x
where convert val
| t <= 0 = 0
| t > 8 = 8
@@ -511,8 +511,8 @@ showLogVBar f v = do
| otherwise = f + logBase 2 (x / hh) / bw
showVerticalBar v $ choose v
-showLogDynamicString :: Maybe DynamicString -> Float -> Float -> Monitor String
-showLogDynamicString str f v = do
+showLogIconPattern :: Maybe IconPattern -> Float -> Float -> Monitor String
+showLogIconPattern str f v = do
h <- fromIntegral `fmap` getConfigValue high
l <- fromIntegral `fmap` getConfigValue low
bw <- fromIntegral `fmap` getConfigValue barWidth
@@ -520,4 +520,4 @@ showLogDynamicString str f v = do
choose x | x == 0.0 = 0
| x <= ll = 1 / bw
| otherwise = f + logBase 2 (x / hh) / bw
- showDynamicString str $ choose v
+ showIconPattern str $ choose v
diff --git a/src/Plugins/Monitors/Cpu.hs b/src/Plugins/Monitors/Cpu.hs
index 5abde7e..7fed989 100644
--- a/src/Plugins/Monitors/Cpu.hs
+++ b/src/Plugins/Monitors/Cpu.hs
@@ -21,18 +21,18 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
import System.Console.GetOpt
data CpuOpts = CpuOpts
- { loadDynamicString :: Maybe DynamicString
+ { loadIconPattern :: Maybe IconPattern
}
defaultOpts :: CpuOpts
defaultOpts = CpuOpts
- { loadDynamicString = Nothing
+ { loadIconPattern = Nothing
}
options :: [OptDescr (CpuOpts -> CpuOpts)]
options =
- [ Option "" ["load-dynamic-string"] (ReqArg (\x o ->
- o { loadDynamicString = Just $ parseDynamicString x }) "") ""
+ [ Option "" ["load-icon-pattern"] (ReqArg (\x o ->
+ o { loadIconPattern = Just $ parseIconPattern x }) "") ""
]
parseOpts :: [String] -> IO CpuOpts
@@ -44,7 +44,7 @@ parseOpts argv =
cpuConfig :: IO MConfig
cpuConfig = mkMConfig
"Cpu: <total>%"
- ["bar","vbar","dstr","total","user","nice","system","idle","iowait"]
+ ["bar","vbar","ipat","total","user","nice","system","idle","iowait"]
type CpuDataRef = IORef [Int]
@@ -70,7 +70,7 @@ formatCpu opts xs = do
let t = sum $ take 3 xs
b <- showPercentBar (100 * t) t
v <- showVerticalBar (100 * t) t
- d <- showDynamicString (loadDynamicString opts) t
+ d <- showIconPattern (loadIconPattern opts) t
ps <- showPercentsWithColors (t:xs)
return (b:v:d:ps)
diff --git a/src/Plugins/Monitors/Disk.hs b/src/Plugins/Monitors/Disk.hs
index e020c85..0019c1a 100644
--- a/src/Plugins/Monitors/Disk.hs
+++ b/src/Plugins/Monitors/Disk.hs
@@ -28,9 +28,9 @@ import System.Directory (canonicalizePath, doesFileExist)
import System.Console.GetOpt
data DiskIOOpts = DiskIOOpts
- { totalDynamicString :: Maybe DynamicString
- , writeDynamicString :: Maybe DynamicString
- , readDynamicString :: Maybe DynamicString
+ { totalIconPattern :: Maybe IconPattern
+ , writeIconPattern :: Maybe IconPattern
+ , readIconPattern :: Maybe IconPattern
}
parseDiskIOOpts :: [String] -> IO DiskIOOpts
@@ -39,29 +39,29 @@ parseDiskIOOpts argv =
(o, _, []) -> return $ foldr id defaultOpts o
(_, _, errs) -> ioError . userError $ concat errs
where defaultOpts = DiskIOOpts
- { totalDynamicString = Nothing
- , writeDynamicString = Nothing
- , readDynamicString = Nothing
+ { totalIconPattern = Nothing
+ , writeIconPattern = Nothing
+ , readIconPattern = Nothing
}
options =
- [ Option "" ["total-dynamic-string"] (ReqArg (\x o ->
- o { totalDynamicString = Just $ parseDynamicString x}) "") ""
- , Option "" ["write-dynamic-string"] (ReqArg (\x o ->
- o { writeDynamicString = Just $ parseDynamicString x}) "") ""
- , Option "" ["read-dynamic-string"] (ReqArg (\x o ->
- o { readDynamicString = Just $ parseDynamicString x}) "") ""
+ [ Option "" ["total-icon-pattern"] (ReqArg (\x o ->
+ o { totalIconPattern = Just $ parseIconPattern x}) "") ""
+ , Option "" ["write-icon-pattern"] (ReqArg (\x o ->
+ o { writeIconPattern = Just $ parseIconPattern x}) "") ""
+ , Option "" ["read-icon-pattern"] (ReqArg (\x o ->
+ o { readIconPattern = Just $ parseIconPattern x}) "") ""
]
diskIOConfig :: IO MConfig
diskIOConfig = mkMConfig "" ["total", "read", "write"
,"totalbar", "readbar", "writebar"
,"totalvbar", "readvbar", "writevbar"
- ,"totaldstr", "readdstr", "writedstr"
+ ,"totalipat", "readipat", "writeipat"
]
data DiskUOpts = DiskUOpts
- { freeDynamicString :: Maybe DynamicString
- , usedDynamicString :: Maybe DynamicString
+ { freeIconPattern :: Maybe IconPattern
+ , usedIconPattern :: Maybe IconPattern
}
parseDiskUOpts :: [String] -> IO DiskUOpts
@@ -70,21 +70,21 @@ parseDiskUOpts argv =
(o, _, []) -> return $ foldr id defaultOpts o
(_, _, errs) -> ioError . userError $ concat errs
where defaultOpts = DiskUOpts
- { freeDynamicString = Nothing
- , usedDynamicString = Nothing
+ { freeIconPattern = Nothing
+ , usedIconPattern = Nothing
}
options =
- [ Option "" ["free-dynamic-string"] (ReqArg (\x o ->
- o { freeDynamicString = Just $ parseDynamicString x}) "") ""
- , Option "" ["used-dynamic-string"] (ReqArg (\x o ->
- o { usedDynamicString = Just $ parseDynamicString x}) "") ""
+ [ Option "" ["free-icon-pattern"] (ReqArg (\x o ->
+ o { freeIconPattern = Just $ parseIconPattern x}) "") ""
+ , Option "" ["used-icon-pattern"] (ReqArg (\x o ->
+ o { usedIconPattern = Just $ parseIconPattern x}) "") ""
]
diskUConfig :: IO MConfig
diskUConfig = mkMConfig ""
[ "size", "free", "used", "freep", "usedp"
- , "freebar", "freevbar", "freedstr"
- , "usedbar", "usedvbar", "useddstr"
+ , "freebar", "freevbar", "freeipat"
+ , "usedbar", "usedvbar", "usedipat"
]
type DevName = String
@@ -183,10 +183,10 @@ runDiskIO' opts (tmp, xs) = do
s <- mapM (showWithColors speedToStr) xs
b <- mapM (showLogBar 0.8) xs
vb <- mapM (showLogVBar 0.8) xs
- dstr <- mapM (\(f,v) -> showLogDynamicString (f opts) 0.8 v)
- $ zip [totalDynamicString, readDynamicString, writeDynamicString] xs
+ ipat <- mapM (\(f,v) -> showLogIconPattern (f opts) 0.8 v)
+ $ zip [totalIconPattern, readIconPattern, writeIconPattern] xs
setConfigValue tmp template
- parseTemplate $ s ++ b ++ vb ++ dstr
+ parseTemplate $ s ++ b ++ vb ++ ipat
runDiskIO :: DevDataRef -> [(String, String)] -> [String] -> Monitor String
runDiskIO dref disks argv = do
@@ -225,11 +225,11 @@ runDiskU' opts tmp path = do
sp <- showPercentsWithColors [fr, 1 - fr]
fb <- showPercentBar (fromIntegral freep) fr
fvb <- showVerticalBar (fromIntegral freep) fr
- fdstr <- showDynamicString (freeDynamicString opts) fr
+ fipat <- showIconPattern (freeIconPattern opts) fr
ub <- showPercentBar (fromIntegral $ 100 - freep) (1 - fr)
uvb <- showVerticalBar (fromIntegral $ 100 - freep) (1 - fr)
- udstr <- showDynamicString (usedDynamicString opts) (1 - fr)
- parseTemplate $ [sizeToStr total] ++ s ++ sp ++ [fb,fvb,fdstr,ub,uvb,udstr]
+ uipat <- showIconPattern (usedIconPattern opts) (1 - fr)
+ parseTemplate $ [sizeToStr total] ++ s ++ sp ++ [fb,fvb,fipat,ub,uvb,uipat]
where ign = const (return [0, 0, 0]) :: SomeException -> IO [Integer]
diff --git a/src/Plugins/Monitors/MPD.hs b/src/Plugins/Monitors/MPD.hs
index 3c1615e..1a49ad3 100644
--- a/src/Plugins/Monitors/MPD.hs
+++ b/src/Plugins/Monitors/MPD.hs
@@ -22,7 +22,7 @@ import Control.Concurrent (threadDelay)
mpdConfig :: IO MConfig
mpdConfig = mkMConfig "MPD: <state>"
- [ "bar", "vbar", "dstr", "state", "statei", "volume", "length"
+ [ "bar", "vbar", "ipat", "state", "statei", "volume", "length"
, "lapsed", "remaining", "plength", "ppos", "file"
, "name", "artist", "composer", "performer"
, "album", "title", "track", "genre"
@@ -32,7 +32,7 @@ data MOpts = MOpts
{ mPlaying :: String
, mStopped :: String
, mPaused :: String
- , mLapsedDynamicString :: Maybe DynamicString
+ , mLapsedIconPattern :: Maybe IconPattern
}
defaultOpts :: MOpts
@@ -40,7 +40,7 @@ defaultOpts = MOpts
{ mPlaying = ">>"
, mStopped = "><"
, mPaused = "||"
- , mLapsedDynamicString = Nothing
+ , mLapsedIconPattern = Nothing
}
options :: [OptDescr (MOpts -> MOpts)]
@@ -48,8 +48,8 @@ options =
[ Option "P" ["playing"] (ReqArg (\x o -> o { mPlaying = x }) "") ""
, Option "S" ["stopped"] (ReqArg (\x o -> o { mStopped = x }) "") ""
, Option "Z" ["paused"] (ReqArg (\x o -> o { mPaused = x }) "") ""
- , Option "" ["lapsed-dynamic-string"] (ReqArg (\x o ->
- o { mLapsedDynamicString = Just $ parseDynamicString x }) "") ""
+ , Option "" ["lapsed-icon-pattern"] (ReqArg (\x o ->
+ o { mLapsedIconPattern = Just $ parseIconPattern x }) "") ""
]
runMPD :: [String] -> Monitor String
@@ -91,8 +91,8 @@ parseMPD (Right st) song opts = do
songData <- parseSong song
bar <- showPercentBar (100 * b) b
vbar <- showVerticalBar (100 * b) b
- dstr <- showDynamicString (mLapsedDynamicString opts) b
- return $ [bar, vbar, dstr, ss, si, vol, len, lap, remain, plen, ppos] ++ songData
+ ipat <- showIconPattern (mLapsedIconPattern opts) b
+ return $ [bar, vbar, ipat, ss, si, vol, len, lap, remain, plen, ppos] ++ songData
where s = M.stState st
ss = show s
si = stateGlyph s opts
diff --git a/src/Plugins/Monitors/Mem.hs b/src/Plugins/Monitors/Mem.hs
index 7524989..b19c5a7 100644
--- a/src/Plugins/Monitors/Mem.hs
+++ b/src/Plugins/Monitors/Mem.hs
@@ -19,22 +19,22 @@ import qualified Data.Map as M
import System.Console.GetOpt
data MemOpts = MemOpts
- { usedDynamicString :: Maybe DynamicString
- , freeDynamicString :: Maybe DynamicString
+ { usedIconPattern :: Maybe IconPattern
+ , freeIconPattern :: Maybe IconPattern
}
defaultOpts :: MemOpts
defaultOpts = MemOpts
- { usedDynamicString = Nothing
- , freeDynamicString = Nothing
+ { usedIconPattern = Nothing
+ , freeIconPattern = Nothing
}
options :: [OptDescr (MemOpts -> MemOpts)]
options =
- [ Option "" ["used-dynamic-string"] (ReqArg (\x o ->
- o { usedDynamicString = Just $ parseDynamicString x }) "") ""
- , Option "" ["free-dynamic-string"] (ReqArg (\x o ->
- o { freeDynamicString = Just $ parseDynamicString x }) "") ""
+ [ Option "" ["used-icon-pattern"] (ReqArg (\x o ->
+ o { usedIconPattern = Just $ parseIconPattern x }) "") ""
+ , Option "" ["free-icon-pattern"] (ReqArg (\x o ->
+ o { freeIconPattern = Just $ parseIconPattern x }) "") ""
]
parseOpts :: [String] -> IO MemOpts
@@ -46,7 +46,7 @@ parseOpts argv =
memConfig :: IO MConfig
memConfig = mkMConfig
"Mem: <usedratio>% (<cache>M)" -- template
- ["usedbar", "usedvbar", "useddstr", "freebar", "freevbar", "freedstr", "usedratio", "freeratio",
+ ["usedbar", "usedvbar", "usedipat", "freebar", "freevbar", "freeipat", "usedratio", "freeratio",
"total", "free", "buffer", "cache", "rest", "used"] -- available replacements
fileMEM :: IO String
@@ -76,14 +76,14 @@ formatMem opts (r:fr:xs) =
rr = 100 * r
ub <- showPercentBar rr r
uvb <- showVerticalBar rr r
- udstr <- showDynamicString (usedDynamicString opts) r
+ uipat <- showIconPattern (usedIconPattern opts) r
fb <- showPercentBar (100 - rr) (1 - r)
fvb <- showVerticalBar (100 - rr) ( 1 - r)
- fdstr <- showDynamicString (freeDynamicString opts) (1 - r)
+ fipat <- showIconPattern (freeIconPattern opts) (1 - r)
rs <- showPercentWithColors r
fs <- showPercentWithColors fr
s <- mapM (showWithColors f) xs
- return (ub:uvb:udstr:fb:fvb:fdstr:rs:fs:s)
+ return (ub:uvb:uipat:fb:fvb:fipat:rs:fs:s)
formatMem _ _ = replicate 10 `fmap` getConfigValue naString
runMem :: [String] -> Monitor String
diff --git a/src/Plugins/Monitors/MultiCpu.hs b/src/Plugins/Monitors/MultiCpu.hs
index 9f8c191..eab21da 100644
--- a/src/Plugins/Monitors/MultiCpu.hs
+++ b/src/Plugins/Monitors/MultiCpu.hs
@@ -22,22 +22,22 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef)
import System.Console.GetOpt
data MultiCpuOpts = MultiCpuOpts
- { loadDynamicStrings :: [DynamicString]
- , loadDynamicString :: Maybe DynamicString
+ { loadIconPatterns :: [IconPattern]
+ , loadIconPattern :: Maybe IconPattern
}
defaultOpts :: MultiCpuOpts
defaultOpts = MultiCpuOpts
- { loadDynamicStrings = []
- , loadDynamicString = Nothing
+ { loadIconPatterns = []
+ , loadIconPattern = Nothing
}
options :: [OptDescr (MultiCpuOpts -> MultiCpuOpts)]
options =
- [ Option "" ["load-dynamic-string"] (ReqArg (\x o ->
- o { loadDynamicString = Just $ parseDynamicString x }) "") ""
- , Option "" ["load-dynamic-strings"] (ReqArg (\x o ->
- o { loadDynamicStrings = parseDynamicString x : loadDynamicStrings o }) "") ""
+ [ Option "" ["load-icon-pattern"] (ReqArg (\x o ->
+ o { loadIconPattern = Just $ parseIconPattern x }) "") ""
+ , Option "" ["load-icon-patterns"] (ReqArg (\x o ->
+ o { loadIconPatterns = parseIconPattern x : loadIconPatterns o }) "") ""
]
parseOpts :: [String] -> IO MultiCpuOpts
@@ -47,7 +47,7 @@ parseOpts argv =
(_, _, errs) -> ioError . userError $ concat errs
variables :: [String]
-variables = ["bar", "vbar","dstr","total","user","nice","system","idle"]
+variables = ["bar", "vbar","ipat","total","user","nice","system","idle"]
vNum :: Int
vNum = length variables
@@ -91,12 +91,12 @@ formatCpu opts i xs
| otherwise = let t = sum $ take 3 xs
in do b <- showPercentBar (100 * t) t
h <- showVerticalBar (100 * t) t
- d <- showDynamicString tryString t
+ d <- showIconPattern tryString t
ps <- showPercentsWithColors (t:xs)
return (b:h:d:ps)
where tryString
- | i == 0 = loadDynamicString opts
- | i <= length (loadDynamicStrings opts) = Just $ (loadDynamicStrings opts) !! (i - 1)
+ | i == 0 = loadIconPattern opts
+ | i <= length (loadIconPatterns opts) = Just $ (loadIconPatterns opts) !! (i - 1)
| otherwise = Nothing
splitEvery :: (Eq a) => Int -> [a] -> [[a]]
diff --git a/src/Plugins/Monitors/Net.hs b/src/Plugins/Monitors/Net.hs
index 137770c..5954a77 100644
--- a/src/Plugins/Monitors/Net.hs
+++ b/src/Plugins/Monitors/Net.hs
@@ -30,22 +30,22 @@ import System.Console.GetOpt
import qualified Data.ByteString.Lazy.Char8 as B
data NetOpts = NetOpts
- { rxDynamicString :: Maybe DynamicString
- , txDynamicString :: Maybe DynamicString
+ { rxIconPattern :: Maybe IconPattern
+ , txIconPattern :: Maybe IconPattern
}
defaultOpts :: NetOpts
defaultOpts = NetOpts
- { rxDynamicString = Nothing
- , txDynamicString = Nothing
+ { rxIconPattern = Nothing
+ , txIconPattern = Nothing
}
options :: [OptDescr (NetOpts -> NetOpts)]
options =
- [ Option "" ["rx-dynamic-string"] (ReqArg (\x o ->
- o { rxDynamicString = Just $ parseDynamicString x }) "") ""
- , Option "" ["tx-dynamic-string"] (ReqArg (\x o ->
- o { txDynamicString = Just $ parseDynamicString x }) "") ""
+ [ Option "" ["rx-icon-pattern"] (ReqArg (\x o ->
+ o { rxIconPattern = Just $ parseIconPattern x }) "") ""
+ , Option "" ["tx-icon-pattern"] (ReqArg (\x o ->
+ o { txIconPattern = Just $ parseIconPattern x }) "") ""
]
parseOpts :: [String] -> IO NetOpts
@@ -88,7 +88,7 @@ instance Ord NetDev where
netConfig :: IO MConfig
netConfig = mkMConfig
"<dev>: <rx>KB|<tx>KB" -- template
- ["dev", "rx", "tx", "rxbar", "rxvbar", "rxdstr", "txbar", "txvbar", "txdstr"] -- available replacements
+ ["dev", "rx", "tx", "rxbar", "rxvbar", "rxipat", "txbar", "txvbar", "txipat"] -- available replacements
operstateDir :: String -> FilePath
operstateDir d = "/sys/class/net" </> d </> "operstate"
@@ -132,8 +132,8 @@ findNetDev dev = do
isDev (NI d) = d == dev
isDev NA = False
-formatNet :: Maybe DynamicString -> Float -> Monitor (String, String, String, String)
-formatNet mdstr d = do
+formatNet :: Maybe IconPattern -> Float -> Monitor (String, String, String, String)
+formatNet mipat d = do
s <- getConfigValue useSuffix
dd <- getConfigValue decDigits
let str True v = showDigits dd d' ++ show u
@@ -141,17 +141,17 @@ formatNet mdstr d = do
str False v = showDigits dd $ v / 1024
b <- showLogBar 0.9 d
vb <- showLogVBar 0.9 d
- dstr <- showLogDynamicString mdstr 0.9 d
+ ipat <- showLogIconPattern mipat 0.9 d
x <- showWithColors (str s) d
- return (x, b, vb, dstr)
+ return (x, b, vb, ipat)
printNet :: NetOpts -> NetDev -> Monitor String
printNet opts nd =
case nd of
ND d r t -> do
- (rx, rb, rvb, rdstr) <- formatNet (rxDynamicString opts) r
- (tx, tb, tvb, tdstr) <- formatNet (txDynamicString opts) t
- parseTemplate [d,rx,tx,rb,rvb,rdstr,tb,tvb,tdstr]
+ (rx, rb, rvb, ripat) <- formatNet (rxIconPattern opts) r
+ (tx, tb, tvb, tipat) <- formatNet (txIconPattern opts) t
+ parseTemplate [d,rx,tx,rb,rvb,ripat,tb,tvb,tipat]
NI _ -> return ""
NA -> getConfigValue naString
diff --git a/src/Plugins/Monitors/Volume.hs b/src/Plugins/Monitors/Volume.hs
index 2787a3c..8c39b9f 100644
--- a/src/Plugins/Monitors/Volume.hs
+++ b/src/Plugins/Monitors/Volume.hs
@@ -24,7 +24,7 @@ import System.Console.GetOpt
volumeConfig :: IO MConfig
volumeConfig = mkMConfig "Vol: <volume>% <status>"
- ["volume", "volumebar", "volumevbar", "dB","status", "volumedstr"]
+ ["volume", "volumebar", "volumevbar", "dB","status", "volumeipat"]
data VolumeOpts = VolumeOpts
@@ -34,7 +34,7 @@ data VolumeOpts = VolumeOpts
, offColor :: Maybe String
, highDbThresh :: Float
, lowDbThresh :: Float
- , volumeDynamicString :: Maybe DynamicString
+ , volumeIconPattern :: Maybe IconPattern
}
defaultOpts :: VolumeOpts
@@ -45,7 +45,7 @@ defaultOpts = VolumeOpts
, offColor = Just "red"
, highDbThresh = -5.0
, lowDbThresh = -30.0
- , volumeDynamicString = Nothing
+ , volumeIconPattern = Nothing
}
options :: [OptDescr (VolumeOpts -> VolumeOpts)]
@@ -56,8 +56,8 @@ options =
, Option "" ["highd"] (ReqArg (\x o -> o { highDbThresh = read x }) "") ""
, Option "C" ["onc"] (ReqArg (\x o -> o { onColor = Just x }) "") ""
, Option "c" ["offc"] (ReqArg (\x o -> o { offColor = Just x }) "") ""
- , Option "" ["volume-dynamic-string"] (ReqArg (\x o ->
- o { volumeDynamicString = Just $ parseDynamicString x }) "") ""
+ , Option "" ["volume-icon-pattern"] (ReqArg (\x o ->
+ o { volumeIconPattern = Just $ parseIconPattern x }) "") ""
]
parseOpts :: [String] -> IO VolumeOpts
@@ -84,9 +84,9 @@ formatVolVBar :: Integer -> Integer -> Integer -> Monitor String
formatVolVBar lo hi v =
showVerticalBar (100 * x) x where x = percent v lo hi
-formatVolDStr :: Maybe DynamicString -> Integer -> Integer -> Integer -> Monitor String
-formatVolDStr dstr lo hi v =
- showDynamicString dstr $ percent v lo hi
+formatVolDStr :: Maybe IconPattern -> Integer -> Integer -> Integer -> Monitor String
+formatVolDStr ipat lo hi v =
+ showIconPattern ipat $ percent v lo hi
switchHelper :: VolumeOpts
-> (VolumeOpts -> Maybe String)
@@ -134,8 +134,8 @@ runVolume mixerName controlName argv = do
v <- liftMonitor $ liftM3 formatVolVBar lo hi val
d <- getFormatDB opts db
s <- getFormatSwitch opts sw
- dstr <- liftMonitor $ liftM3 (formatVolDStr $ volumeDynamicString opts) lo hi val
- parseTemplate [p, b, v, d, s, dstr]
+ ipat <- liftMonitor $ liftM3 (formatVolDStr $ volumeIconPattern opts) lo hi val
+ parseTemplate [p, b, v, d, s, ipat]
where
diff --git a/src/Plugins/Monitors/Wireless.hs b/src/Plugins/Monitors/Wireless.hs
index c87bec6..b1e3c7e 100644
--- a/src/Plugins/Monitors/Wireless.hs
+++ b/src/Plugins/Monitors/Wireless.hs
@@ -20,18 +20,18 @@ import Plugins.Monitors.Common
import IWlib
data WirelessOpts = WirelessOpts
- { qualityDynamicString :: Maybe DynamicString
+ { qualityIconPattern :: Maybe IconPattern
}
defaultOpts :: WirelessOpts
defaultOpts = WirelessOpts
- { qualityDynamicString = Nothing
+ { qualityIconPattern = Nothing
}
options :: [OptDescr (WirelessOpts -> WirelessOpts)]
options =
- [ Option "" ["quality-dynamic-string"] (ReqArg (\d opts ->
- opts { qualityDynamicString = Just $ parseDynamicString d }) "") ""
+ [ Option "" ["quality-icon-pattern"] (ReqArg (\d opts ->
+ opts { qualityIconPattern = Just $ parseIconPattern d }) "") ""
]
parseOpts :: [String] -> IO WirelessOpts
@@ -42,7 +42,7 @@ parseOpts argv =
wirelessConfig :: IO MConfig
wirelessConfig =
- mkMConfig "<essid> <quality>" ["essid", "quality", "qualitybar", "qualityvbar", "qualitydstr"]
+ mkMConfig "<essid> <quality>" ["essid", "quality", "qualitybar", "qualityvbar", "qualityipat"]
runWireless :: String -> [String] -> Monitor String
runWireless iface args = do
@@ -58,5 +58,5 @@ runWireless iface args = do
else showWithPadding ""
qb <- showPercentBar qlty (qlty / 100)
qvb <- showVerticalBar qlty (qlty / 100)
- qdstr <- showDynamicString (qualityDynamicString opts) (qlty / 100)
- parseTemplate [ep, q, qb, qvb, qdstr]
+ qipat <- showIconPattern (qualityIconPattern opts) (qlty / 100)
+ parseTemplate [ep, q, qb, qvb, qipat]