diff options
author | jao <jao@gnu.org> | 2014-09-28 00:36:33 +0200 |
---|---|---|
committer | jao <jao@gnu.org> | 2014-09-28 00:36:33 +0200 |
commit | 5c6252dc55a87a42c3cd43e5ffab7e9328004f4d (patch) | |
tree | 1d43f2336e0ba9446db139fe7c8dc3e9667fbd5c /src/Plugins | |
parent | 6b9dfabf23b7c48a86c3553a63ebb3924bea8d46 (diff) | |
download | xmobar-5c6252dc55a87a42c3cd43e5ffab7e9328004f4d.tar.gz xmobar-5c6252dc55a87a42c3cd43e5ffab7e9328004f4d.tar.bz2 |
Using fromMaybe
Diffstat (limited to 'src/Plugins')
-rw-r--r-- | src/Plugins/Monitors/MPD.hs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/Plugins/Monitors/MPD.hs b/src/Plugins/Monitors/MPD.hs index e02a747..5e02587 100644 --- a/src/Plugins/Monitors/MPD.hs +++ b/src/Plugins/Monitors/MPD.hs @@ -15,6 +15,7 @@ module Plugins.Monitors.MPD ( mpdConfig, runMPD, mpdWait, mpdReady ) where import Data.List +import Data.Maybe (fromMaybe) import Plugins.Monitors.Common import System.Console.GetOpt import qualified Network.MPD as M @@ -96,12 +97,8 @@ parseMPD (Right st) song opts = do where s = M.stState st ss = show s si = stateGlyph s opts - 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) + vol = int2str $ fromMaybe 0 (M.stVolume st) + (p, t) = fromMaybe (0, 0) (M.stTime st) [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 |