diff options
-rw-r--r-- | news.md | 1 | ||||
-rw-r--r-- | src/Plugins/Monitors/MPD.hs | 10 | ||||
-rw-r--r-- | xmobar.cabal | 2 |
3 files changed, 9 insertions, 4 deletions
@@ -22,6 +22,7 @@ _New features_ collection of icons to use for successive integer variable values, thanks to Alexander Shabalin (see [pull request #192] and the documentation for details). + - Upgrade to libmpd 0.9. _Bug fixes_ diff --git a/src/Plugins/Monitors/MPD.hs b/src/Plugins/Monitors/MPD.hs index 1a49ad3..e02a747 100644 --- a/src/Plugins/Monitors/MPD.hs +++ b/src/Plugins/Monitors/MPD.hs @@ -75,7 +75,7 @@ mpdReady _ = do -- Only cases where MPD isn't responding is an issue; bogus information at -- least won't hold xmobar up. Left M.NoMPD -> return False - Left M.TimedOut -> return False + Left (M.ConnectionError _) -> return False Left _ -> return True mopts :: [String] -> IO MOpts @@ -96,8 +96,12 @@ parseMPD (Right st) song opts = do where s = M.stState st ss = show s si = stateGlyph s opts - vol = int2str $ M.stVolume st - (p, t) = M.stTime st + vol = int2str $ case M.stVolume st of + Just x -> x + Nothing -> 0 + (p, t) = case M.stTime st of + Just x -> x + Nothing -> (0, 0) [lap, len, remain] = map showTime [floor p, t, max 0 (t - floor p)] b = if t > 0 then realToFrac $ p / fromIntegral t else 0 plen = int2str $ M.stPlaylistLength st diff --git a/xmobar.cabal b/xmobar.cabal index 58676a5..13a74a9 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -146,7 +146,7 @@ executable xmobar cpp-options: -DIWLIB if flag(with_mpd) || flag(all_extensions) - build-depends: libmpd == 0.8.* + build-depends: libmpd == 0.9.* other-modules: Plugins.Monitors.MPD cpp-options: -DLIBMPD |