summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/MPD.hs
diff options
context:
space:
mode:
authorAlexander Shabalin <shabalyn.a@gmail.com>2014-09-07 22:24:00 +0400
committerAlexander Shabalin <shabalyn.a@gmail.com>2014-09-14 12:03:48 +0400
commite590f14593728b8afc2b77e8be356e5c06428107 (patch)
tree7a316e70cc1c7ae84499516f61579f755b7dce0a /src/Plugins/Monitors/MPD.hs
parente8e4415b7eba49d2d6ddb18ab13b3151c9a787bd (diff)
downloadxmobar-e590f14593728b8afc2b77e8be356e5c06428107.tar.gz
xmobar-e590f14593728b8afc2b77e8be356e5c06428107.tar.bz2
Implement DynamicString for Monitors supporting vbar.
* Batt * Bright * Cpu * Disk * MPD * Mem * MultiCpu * Net * Volume * Wireless
Diffstat (limited to 'src/Plugins/Monitors/MPD.hs')
-rw-r--r--src/Plugins/Monitors/MPD.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/MPD.hs b/src/Plugins/Monitors/MPD.hs
index ac976f2..3c1615e 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", "state", "statei", "volume", "length"
+ [ "bar", "vbar", "dstr", "state", "statei", "volume", "length"
, "lapsed", "remaining", "plength", "ppos", "file"
, "name", "artist", "composer", "performer"
, "album", "title", "track", "genre"
@@ -32,6 +32,7 @@ data MOpts = MOpts
{ mPlaying :: String
, mStopped :: String
, mPaused :: String
+ , mLapsedDynamicString :: Maybe DynamicString
}
defaultOpts :: MOpts
@@ -39,6 +40,7 @@ defaultOpts = MOpts
{ mPlaying = ">>"
, mStopped = "><"
, mPaused = "||"
+ , mLapsedDynamicString = Nothing
}
options :: [OptDescr (MOpts -> MOpts)]
@@ -46,6 +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 }) "") ""
]
runMPD :: [String] -> Monitor String
@@ -87,7 +91,8 @@ parseMPD (Right st) song opts = do
songData <- parseSong song
bar <- showPercentBar (100 * b) b
vbar <- showVerticalBar (100 * b) b
- return $ [bar, vbar, ss, si, vol, len, lap, remain, plen, ppos] ++ songData
+ dstr <- showDynamicString (mLapsedDynamicString opts) b
+ return $ [bar, vbar, dstr, ss, si, vol, len, lap, remain, plen, ppos] ++ songData
where s = M.stState st
ss = show s
si = stateGlyph s opts