summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2011-03-15 22:27:22 -0400
committerBen Boeckel <MathStuf@gmail.com>2011-03-15 22:27:22 -0400
commit8d3743e40a26e5c75b4ae53468e1384e38f86a0f (patch)
tree37df0be18e4a3c34d60fa54da3d95ff88796ae73
parent2924fab4d7fa1185acbb01362daf9cc4a77791d1 (diff)
downloadxmobar-8d3743e40a26e5c75b4ae53468e1384e38f86a0f.tar.gz
xmobar-8d3743e40a26e5c75b4ae53468e1384e38f86a0f.tar.bz2
Use the environment to configure the MPD server
-rw-r--r--README6
-rw-r--r--src/Plugins/Monitors/MPD.hs8
2 files changed, 4 insertions, 10 deletions
diff --git a/README b/README
index 3bb4a6b..ea0a216 100644
--- a/README
+++ b/README
@@ -611,9 +611,9 @@ Monitors have default aliases.
- Aliases to `mpd`
- Args: default monitor arguments (see below). In addition you can provide
`-P`, `-S` and `-Z`, with an string argument, to represent the
- playing, stopped and paused states in the `statei` template field,
- and `-h`, `-p` and `-x` for the host, port and password (default
- host is "localhost", port 6600 and empty password).
+ 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.
- Variables that can be used with the `-t`/`--template` argument:
`bar`, `state`, `statei`, `volume`, `length`
`lapsed`, `remaining`,
diff --git a/src/Plugins/Monitors/MPD.hs b/src/Plugins/Monitors/MPD.hs
index daf0ed4..f17e6c5 100644
--- a/src/Plugins/Monitors/MPD.hs
+++ b/src/Plugins/Monitors/MPD.hs
@@ -40,9 +40,6 @@ defaultOpts = MOpts
{ mPlaying = ">>"
, mStopped = "><"
, mPaused = "||"
- , mHost = "127.0.0.1"
- , mPort = 6600
- , mPassword = ""
}
options :: [OptDescr (MOpts -> MOpts)]
@@ -50,15 +47,12 @@ 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 "h" ["host"] (ReqArg (\x o -> o { mHost = x }) "") ""
- , Option "p" ["port"] (ReqArg (\x o -> o { mPort = read x }) "") ""
- , Option "x" ["password"] (ReqArg (\x o -> o { mPassword = x }) "") ""
]
runMPD :: [String] -> Monitor String
runMPD args = do
opts <- io $ mopts args
- let mpd = M.withMPDEx (mHost opts) (mPort opts) (mPassword opts)
+ let mpd = M.withMPD
status <- io $ mpd M.status
song <- io $ mpd M.currentSong
s <- parseMPD status song opts