xmobar 0.30 → 0.31
raw patch · 7 files changed
+48/−29 lines, 7 filesdep ~libmpd
Dependency ranges changed: libmpd
Files
- changelog.md +11/−1
- readme.md +4/−2
- src/Xmobar/App/Compile.hs +9/−9
- src/Xmobar/App/Main.hs +7/−6
- src/Xmobar/Plugins/Monitors/MPD.hs +3/−3
- src/Xmobar/Plugins/Monitors/MultiCpu.hs +12/−6
- xmobar.cabal +2/−2
changelog.md view
@@ -1,10 +1,20 @@+## Version 0.31++_New features_++ - New option `--contiguous-icons` for `MultiCpu` to draw icons+ without padding (see [issue #388]).+ - New version of libmpd (0.9.0.10), thanks to John Tyree++[issue #388]: https://github.com/jaor/xmobar/issues/388+ ## Version 0.30 (August, 2019) _New features_ - New monitor `MultiCoreTemp`, thanks to Felix Springer. - `DiskIO`: Additional template variables for absolute number of- bytes rather than speeds (see [issue #390].+ bytes rather than speeds (see [issue #390]). - `WeatherX`: An extension to the `Weather` monitor allowing the spefication of custom strings or icons for sky conditions. - The battery monitors accept the new arguments `-a` and `-A` to
readme.md view
@@ -866,6 +866,8 @@ corresponds to nth cpu. - `--fallback-icon-pattern`: dynamic string used by `autoipat` and `ipat{i}` when no `--load-icon-patterns` has been provided for `cpu{i}`+ - `--contiguous-icons`: flag (no value needs to be provided) that+ causes the load icons to be drawn without padding. - Thresholds refer to percentage of CPU load - Variables that can be used with the `-t`/`--template` argument: `autototal`, `autobar`, `autovbar`, `autoipat`, `autouser`, `autonice`,@@ -1621,8 +1623,8 @@ Alexander Shabalin, Valentin Shirokov, Peter Simons, Alexander Solovyov, Will Song, John Soros, Felix Springer, Travis Staton, Artem Tarasov, Samuli Thomasson, Edward Tjörnhammar, Sergei Trofimovich,-Thomas Tuegel, Jan Vornberger, Anton Vorontsov, Daniel Wagner, Zev-Weiss, Phil Xiaojun Hu, Edward Z. Yang and Norbert Zeh.+Thomas Tuegel, John Tyree, Jan Vornberger, 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/Xmobar/App/Compile.hs view
@@ -131,13 +131,13 @@ -- -- 'False' is returned if there are compilation errors. ---recompile :: MonadIO m => String -> String -> Bool -> Bool -> m Bool-recompile dir execName force verb = liftIO $ do- let bin = dir </> execName- err = dir </> (execName ++ ".errors")- src = dir </> (execName ++ ".hs")- lib = dir </> "lib"- script = dir </> "build"+recompile :: MonadIO m => String -> String -> String -> Bool -> Bool -> m Bool+recompile confDir dataDir execName force verb = liftIO $ do+ let bin = confDir </> execName+ err = dataDir </> (execName ++ ".errors")+ src = confDir </> (execName ++ ".hs")+ lib = confDir </> "lib"+ script = confDir </> "build" useScript <- checkBuildScript verb script sc <- if useScript || force then return True@@ -149,8 +149,8 @@ \errHandle -> waitForProcess =<< if useScript- then runScript script bin dir errHandle- else runGHC bin dir errHandle+ then runScript script bin confDir errHandle+ else runGHC bin confDir errHandle installSignalHandlers if status == ExitSuccess then trace verb "Xmobar recompilation process exited with success!"
src/Xmobar/App/Main.hs view
@@ -70,14 +70,14 @@ for_ (concat vars) $ \(asyncs, _) -> for_ asyncs cancel -buildLaunch :: Bool -> Bool -> FilePath -> ParseError -> IO ()-buildLaunch verb force p e = do+buildLaunch :: Bool -> Bool -> FilePath -> String -> ParseError -> IO ()+buildLaunch verb force p datadir e = do let exec = takeBaseName p- dir = takeDirectory p+ confDir = takeDirectory p ext = takeExtension p if ext `elem` [".hs", ".hsc", ".lhs"]- then recompile dir exec force verb >>- executeFile (dir </> exec) False [] Nothing+ then recompile confDir datadir exec force verb >>+ executeFile (confDir </> exec) False [] Nothing else trace True ("Invalid configuration file: " ++ show e) >> trace True "\n(No compilation attempted: \ \only .hs, .hsc or .lhs files are compiled)"@@ -101,7 +101,8 @@ (c:_) -> error $ c ++ ": file not found" _ -> doOpts defaultConfig flags >>= xmobar Just p -> do r <- readConfig defaultConfig p+ dataDir <- xmobarDataDir case r of Left e ->- buildLaunch (verboseFlag flags) (recompileFlag flags) p e+ buildLaunch (verboseFlag flags) (recompileFlag flags) p dataDir e Right (c, defs) -> doOpts c flags >>= xmobar' defs
src/Xmobar/Plugins/Monitors/MPD.hs view
@@ -99,13 +99,13 @@ si = stateGlyph s opts 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+ [lap, len, remain] = map showTime [floor p, floor t, max 0 (floor t - floor p)]+ b = if t > 0 then realToFrac $ p / t else 0 plen = int2str $ M.stPlaylistLength st ppos = maybe "" (int2str . (+1)) $ M.stSongPos st flags = playbackMode st -stateGlyph :: M.State -> MOpts -> String+stateGlyph :: M.PlaybackState -> MOpts -> String stateGlyph s o = case s of M.Playing -> mPlaying o
src/Xmobar/Plugins/Monitors/MultiCpu.hs view
@@ -25,6 +25,7 @@ { loadIconPatterns :: [IconPattern] , loadIconPattern :: Maybe IconPattern , fallbackIconPattern :: Maybe IconPattern+ , contiguous :: Bool } defaultOpts :: MultiCpuOpts@@ -32,6 +33,7 @@ { loadIconPatterns = [] , loadIconPattern = Nothing , fallbackIconPattern = Nothing+ , contiguous = False } options :: [OptDescr (MultiCpuOpts -> MultiCpuOpts)]@@ -42,6 +44,7 @@ o { loadIconPatterns = parseIconPattern x : loadIconPatterns o }) "") "" , Option "" ["fallback-icon-pattern"] (ReqArg (\x o -> o { fallbackIconPattern = Just $ parseIconPattern x }) "") ""+ , Option "" ["contiguous-icons"] (NoArg (\o -> o {contiguous = True})) "" ] parseOpts :: [String] -> IO MultiCpuOpts@@ -87,7 +90,8 @@ formatMultiCpus :: MultiCpuOpts -> [[Float]] -> Monitor [String] formatMultiCpus _ [] = return []-formatMultiCpus opts xs = concat <$> mapM (\(i, x) -> formatCpu opts i x) (zip [0..] xs)+formatMultiCpus opts xs =+ concat <$> mapM (\(i, x) -> formatCpu opts i x) (zip [0..] xs) formatCpu :: MultiCpuOpts -> Int -> [Float] -> Monitor [String] formatCpu opts i xs@@ -100,7 +104,8 @@ 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 = fallbackIconPattern opts splitEvery :: Int -> [a] -> [[a]]@@ -109,16 +114,17 @@ groupData :: [String] -> [[String]] groupData = transpose . tail . splitEvery vNum -formatAutoCpus :: [String] -> Monitor [String]-formatAutoCpus [] = return $ replicate vNum ""-formatAutoCpus xs = return $ map unwords (groupData xs)+formatAutoCpus :: MultiCpuOpts -> [String] -> Monitor [String]+formatAutoCpus _ [] = return $ replicate vNum ""+formatAutoCpus opts xs =+ return $ map (if contiguous opts then concat else unwords) (groupData xs) runMultiCpu :: CpuDataRef -> [String] -> Monitor String runMultiCpu cref argv = do c <- io $ parseCpuData cref opts <- io $ parseOpts argv l <- formatMultiCpus opts c- a <- formatAutoCpus l+ a <- formatAutoCpus opts l parseTemplate $ a ++ l startMultiCpu :: [String] -> Int -> (String -> IO ()) -> IO ()
xmobar.cabal view
@@ -1,5 +1,5 @@ name: xmobar-version: 0.30+version: 0.31 homepage: http://xmobar.org synopsis: A Minimalistic Text Based Status Bar description: Xmobar is a minimalistic text based status bar.@@ -215,7 +215,7 @@ cpp-options: -DIWLIB if flag(with_mpd) || flag(all_extensions)- build-depends: libmpd >= 0.9.0.6+ build-depends: libmpd >= 0.9.0.10 exposed-modules: Xmobar.Plugins.Monitors.MPD cpp-options: -DLIBMPD