summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-11-24 02:22:55 +0000
committerjao <jao@gnu.org>2020-11-24 02:22:55 +0000
commit94c43a3125418d2233f8b4f5af645b0e4ac3fb2b (patch)
tree01dcfff47f5bf0820cb6a779da1dc39d51bc8bb6
parenta071c2a49d0804e410cdc3aeb9c49b622c9a416a (diff)
downloadxmobar-94c43a3125418d2233f8b4f5af645b0e4ac3fb2b.tar.gz
xmobar-94c43a3125418d2233f8b4f5af645b0e4ac3fb2b.tar.bz2
New monitor: MPDX
-rw-r--r--changelog.md2
-rw-r--r--readme.md5
-rw-r--r--src/Xmobar/Plugins/Monitors.hs7
3 files changed, 12 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 28ae950..cfa9ada 100644
--- a/changelog.md
+++ b/changelog.md
@@ -3,6 +3,8 @@
_New features_
- New command line option `--add-font` (Ivan Brennan)
+ - New monitor `MPDX` that extends `MPD` with the ability of having a
+ custom alias. Useful for connecting with multiple servers.
_Bug fixes_
diff --git a/readme.md b/readme.md
index 7f3848c..5284d88 100644
--- a/readme.md
+++ b/readme.md
@@ -45,6 +45,7 @@
- [`Volume Mixer Element Args RefreshRate`](#volume-mixer-element-args-refreshrate)
- [`Alsa Mixer Element Args`](#alsa-mixer-element-args)
- [`MPD Args RefreshRate`](#mpd-args-refreshrate)
+ - [`MPDX Alias Args RefreshRate`](#mpdx-alias-args-refreshrate)
- [`Mpris1 PlayerName Args RefreshRate`](#mpris1-playername-args-refreshrate)
- [`Mpris2 PlayerName Args RefreshRate`](#mpris2-playername-args-refreshrate)
- [`Mail Args Alias`](#mail-args-alias)
@@ -1274,6 +1275,10 @@ following differences:
"<composer> <title> (<album>) <track>/<plength> <statei> [<flags>]",
"--", "-P", ">>", "-Z", "|", "-S", "><"] 10
+## `MPDX Alias Args RefreshRate`
+
+Like `MPD` but uses as alias its first argument instead of "mpd".
+
## `Mpris1 PlayerName Args RefreshRate`
- Aliases to `mpris1`
diff --git a/src/Xmobar/Plugins/Monitors.hs b/src/Xmobar/Plugins/Monitors.hs
index 322d401..cca0948 100644
--- a/src/Xmobar/Plugins/Monitors.hs
+++ b/src/Xmobar/Plugins/Monitors.hs
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Xmobar.Plugins.Monitors
--- Copyright : (c) 2010, 2011, 2012, 2013, 2017, 2018, 2019 Jose Antonio Ortega Ruiz
+-- Copyright : (c) 2010, 2011, 2012, 2013, 2017, 2018, 2019, 2020 Jose Antonio Ortega Ruiz
-- (c) 2007-10 Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -89,7 +89,8 @@ data Monitors = Network Interface Args Rate
| Wireless Interface Args Rate
#endif
#ifdef LIBMPD
- | MPD Args Rate
+ | MPD Args Rate
+ | MPDX String Args Rate
| AutoMPD Args
#endif
#ifdef ALSA
@@ -148,6 +149,7 @@ instance Exec Monitors where
#ifdef LIBMPD
alias (MPD _ _) = "mpd"
alias (AutoMPD _) = "autompd"
+ alias (MPDX a _ _) = a
#endif
#ifdef ALSA
alias (Volume m c _ _) = m ++ ":" ++ c
@@ -191,6 +193,7 @@ instance Exec Monitors where
#endif
#ifdef LIBMPD
start (MPD a r) = runMD a mpdConfig runMPD r mpdReady
+ start (MPDX _ a r) = start (MPD a r)
start (AutoMPD a) = runMBD a mpdConfig runMPD mpdWait mpdReady
#endif
#ifdef ALSA