packages feed

xmobar 0.24.3 → 0.24.4

raw patch · 29 files changed

+141/−126 lines, 29 filesdep ~libmpd

Dependency ranges changed: libmpd

Files

news.md view
@@ -1,5 +1,25 @@ % xmobar - Release notes +## Version 0.24.4 (April, 2017)++_Infrastructure_++  - Whe have now an active [Travis CI setup].++[Travi CI setup]: https://travis-ci.org/jaor/xmobar++_Bug fixes_++  - Reduce wakeups rate via rtsopts V0 (with new flag with_rtsopts to+    disable it) (see [issue #89]).+  - Fix Net monitor for lage uptimes and bytecounts (Tomas Janoušek).+  - Fix MultiCpu monitor for large uptimes (Zev Weiss).+  - Fix compilation when XMP is disabled (Sergi Trofimovich).+  - Better fatal error messages (Michael Bishop).+  - More paths to read from in CoreTemp (see [issue #291]).++[issue #291]: https://github.com/jaor/xmobar/issues/291+ ## Version 0.24.3 (Sep 5, 2016)  _Bug fixes_
readme.md view
@@ -1,5 +1,7 @@ % xmobar - a minimalistic status bar +[![Build Status](https://travis-ci.org/jaor/xmobar.svg?branch=master)](https://travis-ci.org/jaor/xmobar)+ # About  xmobar is a minimalistic, mostly text based, status bar. It was@@ -10,7 +12,7 @@ features, like dynamic color management, icons, output templates, and extensibility through plugins. -This page documents xmobar 0.24.3 (see [release notes]).+This page documents xmobar 0.24.4 (see [release notes]).  [This screenshot] shows xmobar running under [sawfish], with antialiased fonts. And [this one] is my desktop with [xmonad] and two@@ -1550,7 +1552,7 @@ In particular, xmobar [incorporates patches] by Axel Angel, Dragos Boca, Ben Boeckel, Duncan Burke, Roman Cheplyaka, Patrick Chilton, Antoine Eiche, Nathaniel Wesley Filardo, John Goerzen, Reto Hablützel,-Juraj Hercek, Tomas Janousek, Spencer Janssen, Roman Joost, Jochen+Juraj Hercek, Tomáš Janoušek, Spencer Janssen, Roman Joost, Jochen Keil, Lennart Kolmodin, Krzysztof Kosciuszkiewicz, Dmitry Kurochkin, Todd Lunter, Robert J. Macomber, Dmitry Malikov, David McLean, Marcin Mikołajczyk, Dino Morelli, Tony Morris, Eric Mrak, Thiago Negri,@@ -1559,8 +1561,8 @@ Shabalin, Valentin Shirokov, Peter Simons, Alexander Solovyov, Will Song, John Soros, Travis Staton, Artem Tarasov, Samuli Thomasson, Edward Tjörnhammar, Sergei Trofimovich, Thomas Tuegel, Jan Vornberger,-Anton Vorontsov, Daniel Wagner, Phil Xiaojun Hu, Edward Z. Yang and-Norbert Zeh.+Anton Vorontsov, Daniel Wagner, Zev Weiss, Phil Xiaojun Hu, Edward+Z. Yang and Norbert Zeh.  [jao]: http://jao.io [incorporates patches]: http://www.ohloh.net/p/xmobar/contributors
src/Bitmap.hs view
@@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Bitmap--- Copyright   :  (C) 2013, 2015 Alexander Polakov+-- Copyright   :  (C) 2013, 2015, 2017 Alexander Polakov -- License     :  BSD3 -- -- Maintainer  :  jao@gnu.org@@ -86,10 +86,10 @@     exist <- doesFileExist p     if exist        then do-            res <- runExceptT $-                    tryXBM #ifdef XPM-                <|> tryXPM+            res <- runExceptT (tryXBM <|> tryXPM)+#else+            res <- runExceptT tryXBM #endif             case res of                  Right b -> return $ Just b@@ -121,7 +121,7 @@         y' = 1 + y - fromIntegral h `div` 2     setForeground d gc fc'     setBackground d gc bc'-    case (shapePixmap i) of+    case shapePixmap i of          Nothing -> return ()          Just mask -> setClipOrigin d gc x y' >> setClipMask d gc mask     case bitmapType i of
src/Environment.hs view
@@ -11,7 +11,7 @@ -- A function to expand environment variables in strings -- ------------------------------------------------------------------------------module Environment where+module Environment(expandEnv) where  import Control.Applicative  ((<$>)) import Data.Maybe           (fromMaybe)
src/IWlib.hsc view
@@ -56,7 +56,7 @@     str <- c_iw_stats i istr stats rng 1     rgr <- c_iw_range i istr rng     c_iw_close i-    if (bcr < 0) then return WirelessInfo { wiEssid = "", wiQuality = 0 } else+    if bcr < 0 then return WirelessInfo { wiEssid = "", wiQuality = 0 } else       do hase <- (#peek struct wireless_config, has_essid) wc :: IO CInt          eon <- (#peek struct wireless_config, essid_on) wc :: IO CInt          essid <- if hase /= 0 && eon /= 0 then@@ -70,6 +70,6 @@                    return $ fromIntegral qualv / mxv               else return 0          let qv = round (100 * (q :: Double))-         return $ WirelessInfo { wiEssid = essid, wiQuality = min 100 qv }+         return WirelessInfo { wiEssid = essid, wiQuality = min 100 qv }     where xqual p = let qp = (#ptr struct iw_param, value) p in             (#peek struct iw_quality, qual) qp :: IO CChar
src/Localize.hsc view
@@ -50,7 +50,7 @@   itemStr <- nl_langinfo item #ifdef UTF8   str <- peekCString itemStr-  return $ if (isUTF8Encoded str) then decodeString str else str+  return $ if isUTF8Encoded str then decodeString str else str #else   peekCString itemStr #endif
src/Main.hs view
@@ -37,7 +37,7 @@ import System.Environment import System.FilePath ((</>)) import System.Posix.Files-import Control.Monad (unless, liftM)+import Control.Monad (unless) import Text.Read (readMaybe)  import Signal (setupSignalHandler)@@ -96,13 +96,13 @@ xdgConfigDir = do env <- getEnvironment                   case lookup "XDG_CONFIG_HOME" env of                        Just val -> return val-                       Nothing  -> liftM (</> ".config") getHomeDirectory+                       Nothing  -> fmap (</> ".config") getHomeDirectory  xmobarConfigDir :: IO FilePath-xmobarConfigDir = liftM (</> "xmobar") xdgConfigDir+xmobarConfigDir = fmap (</> "xmobar") xdgConfigDir  getXdgConfigFile :: IO FilePath-getXdgConfigFile = liftM (</> "xmobarrc") xmobarConfigDir+getXdgConfigFile = fmap (</> "xmobarrc") xmobarConfigDir  -- | Read default configuration file or load the default config readDefaultConfig :: IO (Config,[String])@@ -231,7 +231,7 @@                         "specified with the -" ++ c:" option\n")         readStr str = [x | (x,t) <- reads str, ("","") <- lex t]         doOpts' opts = doOpts opts oo-        readPosition string = +        readPosition string =             case readMaybe string of                 Just x  -> doOpts' (conf { position = x })                 Nothing -> do
src/MinXft.hsc view
@@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- | -- Module: MinXft--- Copyright: (c) 2012, 2014, 2015 Jose Antonio Ortega Ruiz+-- Copyright: (c) 2012, 2014, 2015, 2017 Jose Antonio Ortega Ruiz --            (c) Clemens Fruhwirth <clemens@endorphin.org> 2007 -- License: BSD3-style (see LICENSE) --@@ -179,7 +179,7 @@     mapM_ (\(f, s, _, xo, yo) -> drawXftString d c f (x+xo) (y+yo) s) chunks  -- Split string and determine fonts/offsets for individual parts-getChunks :: Display -> [AXftFont] -> [Char] ->+getChunks :: Display -> [AXftFont] -> String ->              IO [(AXftFont, String, XGlyphInfo, Integer, Integer)] getChunks disp fts str = do     chunks <- getFonts disp fts str@@ -253,7 +253,7 @@     sizeOf _ = #{size XRenderPictureAttributes}     alignment _ = alignment (undefined :: CInt)     peek _ = return XRenderPictureAttributes-    poke p XRenderPictureAttributes = do+    poke p XRenderPictureAttributes =         memset p 0 #{size XRenderPictureAttributes}  -- | Convenience function, gives us an XRender handle to a traditional
src/Parsers.hs view
@@ -25,7 +25,7 @@ import Commands import Actions -import Control.Monad (guard, mzero, liftM)+import Control.Monad (guard, mzero) import qualified Data.Map as Map import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec.Perm@@ -276,7 +276,7 @@                 spaces                 char lead                 s <- manyTill anyChar (rowCont <|> unescQuote)-                (char '"' >> return s) <|> liftM (s ++) (scan '\\')+                (char '"' >> return s) <|> fmap (s ++) (scan '\\')             rowCont    = try $ char '\\' >> string "\n"             unescQuote = lookAhead (noneOf "\\") >> lookAhead (string "\"") 
src/Plugins/BufferedPipeReader.hs view
@@ -27,6 +27,7 @@ data BufferedPipeReader = BufferedPipeReader String [(Int, Bool, String)]     deriving (Read, Show) +{-# NOINLINE signal #-} signal :: MVar SignalType signal = unsafePerformIO newEmptyMVar 
src/Plugins/Date.hs view
@@ -24,7 +24,6 @@ #if ! MIN_VERSION_time(1,5,0) import System.Locale #endif-import Control.Monad (liftM) import Data.Time  data Date = Date String String Int@@ -36,4 +35,4 @@     rate  (Date _ _ r) = r  date :: String -> IO String-date format = liftM (formatTime defaultTimeLocale format) getZonedTime+date format = fmap (formatTime defaultTimeLocale format) getZonedTime
src/Plugins/EWMH.hs view
@@ -150,13 +150,13 @@  windowProperty32 :: String -> Window -> M (Maybe [CLong]) windowProperty32 s w = do-    (C {display}) <- ask+    C {display} <- ask     a <- getAtom s     liftIO $ getWindowProperty32 display a w  windowProperty8 :: String -> Window -> M (Maybe [CChar]) windowProperty8 s w = do-    (C {display}) <- ask+    C {display} <- ask     a <- getAtom s     liftIO $ getWindowProperty8 display a w @@ -190,21 +190,21 @@  updateCurrentDesktop, updateDesktopNames, updateActiveWindow :: Updater updateCurrentDesktop _ = do-    (C {root}) <- ask+    C {root} <- ask     mwp <- windowProperty32 "_NET_CURRENT_DESKTOP" root     case mwp of         Just [x] -> modify (\s -> s { currentDesktop = x })         _        -> return ()  updateActiveWindow _ = do-    (C {root}) <- ask+    C {root} <- ask     mwp <- windowProperty32 "_NET_ACTIVE_WINDOW" root     case mwp of         Just [x] -> modify (\s -> s { activeWindow = fromIntegral x })         _        -> return ()  updateDesktopNames _ = do-    (C {root}) <- ask+    C {root} <- ask     mwp <- windowProperty8 "_NET_DESKTOP_NAMES" root     case mwp of         Just xs -> modify (\s -> s { desktopNames = parse xs })@@ -219,7 +219,7 @@     parse = split . decodeCChar  updateClientList _ = do-    (C {root}) <- ask+    C {root} <- ask     mwp <- windowProperty32 "_NET_CLIENT_LIST" root     case mwp of         Just xs -> do
src/Plugins/Kbd.hsc view
@@ -380,7 +380,7 @@         dpy <- openDisplay ""          -- initial set of layout-        cb =<< (getKbdLay dpy opts)+        cb =<< getKbdLay dpy opts          -- enable listing for         -- group changes@@ -391,7 +391,7 @@         allocaXEvent $ \e -> forever $ do             nextEvent' dpy e             _ <- getEvent e-            cb =<< (getKbdLay dpy opts)+            cb =<< getKbdLay dpy opts          closeDisplay dpy         return ()
src/Plugins/Monitors.hs view
@@ -3,7 +3,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Xmobar.Plugins.Monitors--- Copyright   :  (c) 2010, 2011, 2012, 2013 Jose Antonio Ortega Ruiz+-- Copyright   :  (c) 2010, 2011, 2012, 2013, 2017 Jose Antonio Ortega Ruiz --                (c) 2007-10 Andrea Rossato -- License     :  BSD-style (see LICENSE) --@@ -114,15 +114,15 @@     alias (Cpu _ _) = "cpu"     alias (MultiCpu _ _) = "multicpu"     alias (Battery _ _) = "battery"-    alias (BatteryP {})= "battery"+    alias BatteryP {} = "battery"     alias (BatteryN _ _ _ a)= a     alias (Brightness _ _) = "bright"     alias (CpuFreq _ _) = "cpufreq"     alias (TopProc _ _) = "top"     alias (TopMem _ _) = "topmem"     alias (CoreTemp _ _) = "coretemp"-    alias (DiskU {}) = "disku"-    alias (DiskIO {}) = "diskio"+    alias DiskU {} = "disku"+    alias DiskIO {} = "diskio"     alias (Uptime _ _) = "uptime"     alias (CatInt n _ _ _) = "cat" ++ show n #ifdef UVMETER
src/Plugins/Monitors/Common.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Plugins.Monitors.Common--- Copyright   :  (c) 2010, 2011, 2013, 2016 Jose Antonio Ortega Ruiz+-- Copyright   :  (c) 2010, 2011, 2013, 2016, 2017 Jose Antonio Ortega Ruiz --                (c) 2007-2010 Andrea Rossato -- License     :  BSD-style (see LICENSE) --@@ -296,7 +296,7 @@        ; return (s, com, ss)        }     where-      nonPlaceHolder = liftM concat . many $+      nonPlaceHolder = fmap concat . many $                        many1 (noneOf "<") <|> colorSpec <|> iconSpec  -- | Recognizes color specification and returns it unchanged@@ -365,7 +365,7 @@ parseIconPattern :: String -> IconPattern parseIconPattern path =     let spl = splitOnPercent path-    in \i -> concat $ intersperse (show i) spl+    in \i -> intercalate (show i) spl   where splitOnPercent [] = [[]]         splitOnPercent ('%':'%':xs) = [] : splitOnPercent xs         splitOnPercent (x:xs) =@@ -466,7 +466,7 @@      zipWithM (showWithColors . const) fstrs (map (*100) fs)  showPercentWithColors :: Float -> Monitor String-showPercentWithColors f = liftM head $ showPercentsWithColors [f]+showPercentWithColors f = fmap head $ showPercentsWithColors [f]  showPercentBar :: Float -> Float -> Monitor String showPercentBar v x = do@@ -495,37 +495,22 @@           | otherwise = chr t           where t = 9600 + (round val `div` 12) -showLogBar :: Float -> Float -> Monitor String-showLogBar f v =-  let intConfig c = fromIntegral `fmap` getConfigValue c-  in do-    h <- intConfig high-    l <- intConfig low-    bw <- intConfig barWidth-    let [ll, hh] = sort [l, h]-        choose x | x == 0.0 = 0-                 | x <= ll = 1 / bw-                 | otherwise = f + logBase 2 (x / hh) / bw-    showPercentBar v $ choose v--showLogVBar :: Float -> Float -> Monitor String-showLogVBar f v = do+logScaling :: Float -> Float -> Monitor Float+logScaling f v = do   h <- fromIntegral `fmap` getConfigValue high   l <- fromIntegral `fmap` getConfigValue low   bw <- fromIntegral `fmap` getConfigValue barWidth   let [ll, hh] = sort [l, h]-      choose x | x == 0.0 = 0+      scaled x | x == 0.0 = 0                | x <= ll = 1 / bw                | otherwise = f + logBase 2 (x / hh) / bw-  showVerticalBar v $ choose v+  return $ scaled v +showLogBar :: Float -> Float -> Monitor String+showLogBar f v = logScaling f v >>= showPercentBar v++showLogVBar :: Float -> Float -> Monitor String+showLogVBar f v = logScaling f v >>= showPercentBar v+ showLogIconPattern :: Maybe IconPattern -> Float -> Float -> Monitor String-showLogIconPattern str f v = do-  h <- fromIntegral `fmap` getConfigValue high-  l <- fromIntegral `fmap` getConfigValue low-  bw <- fromIntegral `fmap` getConfigValue barWidth-  let [ll, hh] = sort [l, h]-      choose x | x == 0.0 = 0-               | x <= ll = 1 / bw-               | otherwise = f + logBase 2 (x / hh) / bw-  showIconPattern str $ choose v+showLogIconPattern str f v = logScaling f v >>= showIconPattern str
src/Plugins/Monitors/CoreCommon.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE PatternGuards #-}+{-# LANGUAGE CPP, PatternGuards #-}  ----------------------------------------------------------------------------- -- |@@ -16,8 +16,10 @@  module Plugins.Monitors.CoreCommon where +#if __GLASGOW_HASKELL__ < 800 import Control.Applicative-import Control.Monad+#endif+ import Data.Char hiding (Space) import Data.Function import Data.List@@ -29,7 +31,7 @@                      => String -> [[String]] -> Maybe (String, String -> Int)                      -> (Double -> a) -> (a -> String) -> Monitor String checkedDataRetrieval msg paths lbl trans fmt =-  liftM (fromMaybe msg . listToMaybe . catMaybes) $+  fmap (fromMaybe msg . listToMaybe . catMaybes) $     mapM (\p -> retrieveData p lbl trans fmt) paths  retrieveData :: (Ord a, Num a)@@ -127,7 +129,7 @@ -- | Function to read the contents of the given file(s) readFiles :: (String, Either Int (String, String -> Int))           -> Monitor (Int, String)-readFiles (fval, flbl) = (,) <$> either return (\(f, ex) -> liftM ex+readFiles (fval, flbl) = (,) <$> either return (\(f, ex) -> fmap ex                                                             $ io $ readFile f) flbl                              <*> io (readFile fval) 
src/Plugins/Monitors/CoreTemp.hs view
@@ -39,7 +39,8 @@    failureMessage <- getConfigValue naString    let path = ["/sys/bus/platform/devices/coretemp.", "/temp", "_input"]        path' = ["/sys/bus/platform/devices/coretemp.", "/hwmon/hwmon", "/temp", "_input"]+       path'' = ["/sys/class/hwmon/hwmon", "/device/hwmon/hwmon", "/temp", "_input"]        lbl  = Just ("_label", read . dropWhile (not . isDigit))        divisor = 1e3 :: Double        show' = showDigits (max 0 dn)-   checkedDataRetrieval failureMessage [path, path'] lbl (/divisor) show'+   checkedDataRetrieval failureMessage [path, path', path''] lbl (/divisor) show'
src/Plugins/Monitors/Cpu.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Plugins.Monitors.Cpu--- Copyright   :  (c) 2011 Jose Antonio Ortega Ruiz+-- Copyright   :  (c) 2011, 2017 Jose Antonio Ortega Ruiz --                (c) 2007-2010 Andrea Rossato -- License     :  BSD-style (see LICENSE) --@@ -20,7 +20,7 @@ import Data.IORef (IORef, newIORef, readIORef, writeIORef) import System.Console.GetOpt -data CpuOpts = CpuOpts+newtype CpuOpts = CpuOpts   { loadIconPattern :: Maybe IconPattern   } 
src/Plugins/Monitors/Mpris.hs view
@@ -78,6 +78,7 @@                 , "title", "tracknumber" , "composer", "genre"                 ] +{-# NOINLINE dbusClient #-} dbusClient :: DC.Client dbusClient = unsafePerformIO DC.connectSession @@ -106,7 +107,7 @@                  TypeVariant -> unpack $ fromVar v                  TypeStructure _ ->                    let x = structureItems (fromVar v) in-                     if x == [] then [] else unpack (head x)+                     if null x then [] else unpack (head x)                  _ -> []  getMetadata :: (MprisVersion a) => a -> DC.Client -> String -> IO [(String, Variant)]@@ -141,5 +142,5 @@                                            _ -> (show::Int64 -> String) num                             TypeArray TypeString ->                               let x = arrayItems (fromVar v) in-                                if x == [] then "" else fromVar (head x)+                                if null x then "" else fromVar (head x)                             _ -> ""
src/Plugins/Monitors/MultiCpu.hs view
@@ -58,15 +58,15 @@             [ k ++ n     | n <- "" : map show [0 :: Int ..]                          , k <- variables] -type CpuDataRef = IORef [[Float]]+type CpuDataRef = IORef [[Int]] -cpuData :: IO [[Float]]+cpuData :: IO [[Int]] cpuData = parse `fmap` B.readFile "/proc/stat"   where parse = map parseList . cpuLists         cpuLists = takeWhile isCpu . map B.words . B.lines         isCpu (w:_) = "cpu" `isPrefixOf` B.unpack w         isCpu _ = False-        parseList = map (parseFloat . B.unpack) . tail+        parseList = map (parseInt . B.unpack) . tail  parseCpuData :: CpuDataRef -> IO [[Float]] parseCpuData cref =@@ -76,9 +76,9 @@      let p0 = zipWith percent bs as      return p0 -percent :: [Float] -> [Float] -> [Float]+percent :: [Int] -> [Int] -> [Float] percent b a = if tot > 0 then map (/ tot) $ take 4 dif else [0, 0, 0, 0]-  where dif = zipWith (-) b a+  where dif = map fromIntegral $ zipWith (-) b a         tot = sum dif  formatMultiCpus :: MultiCpuOpts -> [[Float]] -> Monitor [String]@@ -96,10 +96,10 @@                       return (b:h:d:ps)   where tryString           | i == 0 = loadIconPattern opts-          | i <= length (loadIconPatterns opts) = Just $ (loadIconPatterns opts) !! (i - 1)+          | i <= length (loadIconPatterns opts) = Just $ loadIconPatterns opts !! (i - 1)           | otherwise = Nothing -splitEvery :: (Eq a) => Int -> [a] -> [[a]]+splitEvery :: Int -> [a] -> [[a]] splitEvery n = unfoldr (\x -> if null x then Nothing else Just $ splitAt n x)  groupData :: [String] -> [[String]]
src/Plugins/Monitors/Net.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Plugins.Monitors.Net--- Copyright   :  (c) 2011, 2012, 2013, 2014 Jose Antonio Ortega Ruiz+-- Copyright   :  (c) 2011, 2012, 2013, 2014, 2017 Jose Antonio Ortega Ruiz --                (c) 2007-2010 Andrea Rossato -- License     :  BSD-style (see LICENSE) --@@ -20,9 +20,10 @@  import Plugins.Monitors.Common +import Data.Word (Word64) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.Time.Clock (UTCTime, getCurrentTime, diffUTCTime)-import Control.Monad (forM, filterM, liftM)+import Control.Monad (forM, filterM) import System.Directory (getDirectoryContents, doesFileExist) import System.FilePath ((</>)) import System.Console.GetOpt@@ -63,22 +64,26 @@     show MBs = "MB/s"     show GBs = "GB/s" -data NetDev = NA-            | NI String-            | ND String Float Float deriving (Eq,Show,Read)+data NetDev num+    = NA+    | NI String+    | ND String num num deriving (Eq,Show,Read) -type NetDevRef = IORef (NetDev, UTCTime)+type NetDevRawTotal = NetDev Word64+type NetDevRate = NetDev Float +type NetDevRef = IORef (NetDevRawTotal, UTCTime)+ -- The more information available, the better. -- Note that names don't matter. Therefore, if only the names differ, -- a compare evaluates to EQ while (==) evaluates to False.-instance Ord NetDev where+instance Ord num => Ord (NetDev num) where     compare NA NA              = EQ     compare NA _               = LT     compare _  NA              = GT     compare (NI _) (NI _)      = EQ-    compare (NI _) (ND {})     = LT-    compare (ND {}) (NI _)     = GT+    compare (NI _) ND {}       = LT+    compare ND {} (NI _)     = GT     compare (ND _ x1 y1) (ND _ x2 y2) =         if downcmp /= EQ            then downcmp@@ -104,7 +109,7 @@   operstate <- B.readFile (operstateDir d)   return $ (B.unpack . head . B.lines) operstate `elem`  ["up", "unknown"] -readNetDev :: [String] -> IO NetDev+readNetDev :: [String] -> IO NetDevRawTotal readNetDev (d:x:y:_) = do   up <- isUp d   return (if up then ND d (r x) (r y) else NI d)@@ -113,7 +118,7 @@  readNetDev _ = return NA -netParser :: B.ByteString -> IO [NetDev]+netParser :: B.ByteString -> IO [NetDevRawTotal] netParser = mapM (readNetDev . splitDevLine) . readDevLines   where readDevLines = drop 2 . B.lines         splitDevLine = selectCols . wordsBy (`elem` " :") . B.unpack@@ -122,7 +127,7 @@           [] -> []           s' -> w : wordsBy f s'' where (w, s'') = break f s' -findNetDev :: String -> IO NetDev+findNetDev :: String -> IO NetDevRawTotal findNetDev dev = do   nds <- B.readFile "/proc/net/dev" >>= netParser   case filter isDev nds of@@ -145,7 +150,7 @@     x <- showWithColors (str s) d     return (x, b, vb, ipat) -printNet :: NetOpts -> NetDev -> Monitor String+printNet :: NetOpts -> NetDevRate -> Monitor String printNet opts nd =   case nd of     ND d r t -> do@@ -155,7 +160,7 @@     NI _ -> return ""     NA -> getConfigValue naString -parseNet :: NetDevRef -> String -> IO NetDev+parseNet :: NetDevRef -> String -> IO NetDevRate parseNet nref nd = do   (n0, t0) <- readIORef nref   n1 <- findNetDev nd@@ -163,7 +168,7 @@   writeIORef nref (n1, t1)   let scx = realToFrac (diffUTCTime t1 t0)       scx' = if scx > 0 then scx else 1-      rate da db = takeDigits 2 $ (db - da) / scx'+      rate da db = takeDigits 2 $ fromIntegral (db - da) / scx'       diffRate (ND d ra ta) (ND _ rb tb) = ND d (rate ra rb) (rate ta tb)       diffRate (NI d) _ = NI d       diffRate _ (NI d) = NI d@@ -176,7 +181,7 @@   opts <- io $ parseOpts argv   printNet opts dev -parseNets :: [(NetDevRef, String)] -> IO [NetDev]+parseNets :: [(NetDevRef, String)] -> IO [NetDevRate] parseNets = mapM $ uncurry parseNet  runNets :: [(NetDevRef, String)] -> [String] -> Monitor String@@ -184,7 +189,7 @@   dev <- io $ parseActive refs   opts <- io $ parseOpts argv   printNet opts dev-    where parseActive refs' = liftM selectActive (parseNets refs') +    where parseActive refs' = fmap selectActive (parseNets refs')           selectActive = maximum  startNet :: String -> [String] -> Int -> (String -> IO ()) -> IO ()
src/Plugins/Monitors/Thermal.hs view
@@ -14,7 +14,6 @@  module Plugins.Monitors.Thermal where -import Control.Monad (liftM) import qualified Data.ByteString.Lazy.Char8 as B import Plugins.Monitors.Common import System.Posix.Files (fileExist)@@ -34,8 +33,7 @@         file = "/proc/acpi/thermal_zone/" ++ zone ++ "/temperature"     exists <- io $ fileExist file     if exists-        then do number <- io $ liftM ((read :: String -> Int) . stringParser (1, 0)) (B.readFile file)+        then do number <- io $ fmap ((read :: String -> Int) . stringParser (1, 0)) (B.readFile file)                 thermal <- showWithColors show number                 parseTemplate [  thermal ]         else return $ "Thermal (" ++ zone ++ "): N/A"-
src/Plugins/Monitors/UVMeter.hs view
@@ -31,7 +31,7 @@        ["station"                               -- available replacements        ] -data UvInfo = UV { index :: String }+newtype UvInfo = UV { index :: String }     deriving (Show)  uvURL :: String@@ -86,7 +86,7 @@ type AttrName  = String type AttrValue = String -data Attribute = Attribute (AttrName, AttrValue)+newtype Attribute = Attribute (AttrName, AttrValue)     deriving (Show)  data XML = Element String [Attribute] [XML]
src/Plugins/Monitors/Wireless.hs view
@@ -19,7 +19,7 @@ import Plugins.Monitors.Common import IWlib -data WirelessOpts = WirelessOpts+newtype WirelessOpts = WirelessOpts   { qualityIconPattern :: Maybe IconPattern   } 
src/Runnable.hs view
@@ -46,7 +46,7 @@ instance ReadAsAnyOf () ex where     readAsAnyOf ~() = mzero -instance (Show t, Read t, Exec t, ReadAsAnyOf ts Runnable) => ReadAsAnyOf (t,ts) Runnable where+instance (Read t, Exec t, ReadAsAnyOf ts Runnable) => ReadAsAnyOf (t,ts) Runnable where     readAsAnyOf ~(t,ts) = r t `mplus` readAsAnyOf ts               where r ty = do { m <- readPrec; return (Run (m `asTypeOf` ty)) } 
src/Window.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Window--- Copyright   :  (c) 2011-15 Jose A. Ortega Ruiz+-- Copyright   :  (c) 2011-17 Jose A. Ortega Ruiz --             :  (c) 2012 Jochen Keil -- License     :  BSD-style (see LICENSE) --@@ -178,7 +178,7 @@   FullBM m   -> let mp = fi m                     pad = 2 * fi mp +  fi lw                 in sf >> sla >>-                     drawRectangle d p gc mp mp (wi - pad + 1) (ht - pad)+                     drawRectangle d p gc mp mp (wi - pad) (ht - pad)   where sf    = setForeground d gc c         sla   = setLineAttributes d gc (fi lw) lineSolid capNotLast joinMiter         boff  = borderOffset b lw@@ -197,7 +197,7 @@  isMapped :: Display -> Window -> IO Bool isMapped d w = ism <$> getWindowAttributes d w-    where ism (WindowAttributes { wa_map_state = wms }) = wms /= waIsUnmapped+    where ism WindowAttributes { wa_map_state = wms } = wms /= waIsUnmapped  borderOffset :: (Integral a) => Border -> Int -> a borderOffset b lw =
src/XUtil.hsc view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  XUtil--- Copyright   :  (C) 2011, 2012, 2013, 2014, 2015 Jose Antonio Ortega Ruiz+-- Copyright   :  (C) 2011, 2012, 2013, 2014, 2015, 2017 Jose Antonio Ortega Ruiz --                (C) 2007 Andrea Rossato -- License     :  BSD3 --@@ -11,8 +11,6 @@ -- ----------------------------------------------------------------------------- -{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls #-}- module XUtil     ( XFont     , initFont@@ -130,8 +128,7 @@ initXftFont d s = do   setupLocale   let fontNames = wordsBy (== ',') (drop 4 s)-  fonts <- mapM openFont fontNames-  return fonts+  mapM openFont fontNames   where     openFont fontName = do         f <- openAXftFont d (defaultScreenOfDisplay d) fontName@@ -160,7 +157,7 @@ textExtents (Utf8 fs) s = do   let (_,rl)  = wcTextExtents fs s       ascent  = fi $ - (rect_y rl)-      descent = fi $ rect_height rl + (fi $ rect_y rl)+      descent = fi $ rect_height rl + fi (rect_y rl)   return (ascent, descent) #ifdef XFT textExtents (Xft xftfonts) _ = do@@ -185,8 +182,8 @@       io $ wcDrawImageString d p fs gc x y s  #ifdef XFT-printString dpy drw fs@(Xft fonts) _ fc bc x y s al = do-  withDrawingColors dpy drw fc bc $ \draw -> \fc' -> \bc' -> do+printString dpy drw fs@(Xft fonts) _ fc bc x y s al =+  withDrawingColors dpy drw fc bc $ \draw fc' bc' -> do     when (al == 255) $ do       (a,d)  <- textExtents fs s       gi <- xftTxtExtents' dpy fonts s
src/Xmobar.hs view
@@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module      :  Xmobar--- Copyright   :  (c) 2011, 2012, 2013, 2014, 2015 Jose Antonio Ortega Ruiz+-- Copyright   :  (c) 2011, 2012, 2013, 2014, 2015, 2017 Jose Antonio Ortega Ruiz --                (c) 2007 Andrea Rossato -- License     :  BSD-style (see LICENSE) --@@ -106,8 +106,8 @@ #endif     eventLoop tv xcfg [] sig   where-    handler thing (SomeException _) =-      void $ putStrLn ("Thread " ++ thing ++ " failed")+    handler thing (SomeException e) =+      void $ putStrLn ("Thread " ++ thing ++ " failed: " ++ show e)     -- Reacts on events from X     eventer signal =       allocaXEvent $ \e -> do
xmobar.cabal view
@@ -1,5 +1,5 @@ name:               xmobar-version:            0.24.3+version:            0.24.4 homepage:           http://xmobar.org synopsis:           A Minimalistic Text Based Status Bar description: 	    Xmobar is a minimalistic text based status bar.@@ -74,6 +74,10 @@   description: Use threaded runtime.   default: False +flag with_rtsopts+  description: Use -with-rtsopts=-V0 to reduce wakeups+  default: True+ flag with_uvmeter   description: UVMeter only useful to australians.   default: False@@ -87,7 +91,7 @@     main-is:            Main.hs     other-modules:       Xmobar, Actions, Bitmap, Config, Parsers, Commands, Localize,-      XUtil, XPMFile, StatFS, Runnable, ColorCache, Window, Signal,+      XUtil, StatFS, Runnable, ColorCache, Window, Signal,       Environment,       Plugins, Plugins.BufferedPipeReader,       Plugins.CommandReader, Plugins.Date, Plugins.EWMH,@@ -138,8 +142,8 @@        ghc-options: -threaded        cpp-options: -DTHREADED_RUNTIME -    if impl (ghc < 7)-       cpp-options: -DGHC6+    if flag(with_rtsopts)+       ghc-options: -with-rtsopts=-V0      if flag(with_xft) || flag(all_extensions)        build-depends: utf8-string >= 0.3 && < 1.1, X11-xft >= 0.2 && < 0.4@@ -161,7 +165,7 @@        cpp-options: -DIWLIB      if flag(with_mpd) || flag(all_extensions)-       build-depends: libmpd == 0.9.*+       build-depends: libmpd >= 0.9.0.6        other-modules: Plugins.Monitors.MPD        cpp-options: -DLIBMPD