xmobar 0.27 → 0.28
raw patch · 4 files changed
+38/−11 lines, 4 filesdep ~hinotify
Dependency ranges changed: hinotify
Files
- changelog.md +12/−0
- readme.md +14/−1
- src/Commands.hs +8/−6
- xmobar.cabal +4/−4
changelog.md view
@@ -1,3 +1,15 @@+## Version 0.28++_New features_++ - New `ComX`, which runs a command with custom exit error message.++_Bug fixes_++ - hinotify version upgraded ([issue #356])++[issue #356]: https://github.com/jaor/xmobar/issues/356+ ## Version 0.27 (July, 2018) _New features_
readme.md view
@@ -1284,7 +1284,20 @@ Run Com "date" ["+\"%a %b %_d %H:%M\""] "mydate" 600 -can be used in the output template as `%mydate%`+can be used in the output template as `%mydate%`.++Sometimes, you don't mind if the command executed exits with an error,+or you might want to display a custom message in that case. To that+end, you can use the `ComX` variant:++`ComX ProgramName Args ExitMessage Alias RefreshRate`++Works like `Com`, but displaying `ExitMessage` (a string) if the+execution fails. For instance:++ Run ComX "date" ["+\"%a %b %_d %H:%M\""] "N/A" "mydate" 600++will display "N/A" if for some reason the `date` invocation fails. ## Other Plugins
src/Commands.hs view
@@ -48,6 +48,7 @@ trigger _ sh = sh Nothing data Command = Com Program Args Alias Rate+ | ComX Program Args String Alias Rate deriving (Show,Read,Eq) type Args = [String]@@ -56,10 +57,12 @@ type Rate = Int instance Exec Command where- alias (Com p _ a _)- | p /= "" = if a == "" then p else a- | otherwise = ""- start (Com prog args _ r) cb = if r > 0 then go else exec+ alias (ComX p _ _ a _) =+ if p /= "" then (if a == "" then p else a) else ""+ alias (Com p a al r) = alias (ComX p a "" al r)+ start (Com p as al r) cb =+ start (ComX p as ("Could not execute command " ++ p) al r) cb+ start (ComX prog args msg _ r) cb = if r > 0 then go else exec where go = exec >> tenthSeconds r >> go exec = do (i,o,e,p) <- runInteractiveProcess prog args Nothing Nothing@@ -71,8 +74,7 @@ ExitSuccess -> do str <- getL closeHandles cb str- _ -> do closeHandles- cb $ "Could not execute command " ++ prog+ _ -> closeHandles >> cb msg -- | Work around to the Int max bound: since threadDelay takes an Int, it
xmobar.cabal view
@@ -1,5 +1,5 @@ name: xmobar-version: 0.27+version: 0.28 homepage: http://xmobar.org synopsis: A Minimalistic Text Based Status Bar description: Xmobar is a minimalistic text based status bar.@@ -30,7 +30,7 @@ other-modules: Xmobar, Actions, Bitmap, Config, Parsers, Commands, Localize, XUtil, StatFS, Runnable, ColorCache, Window, Signal,- Environment,+ Environment, Paths_xmobar, Plugins, Plugins.BufferedPipeReader, Plugins.CommandReader, Plugins.Date, Plugins.EWMH, Plugins.PipeReader, Plugins.MarqueePipeReader,@@ -139,7 +139,7 @@ other-modules: Xmobar, Actions, Bitmap, Config, Parsers, Commands, Localize, XUtil, StatFS, Runnable, ColorCache, Window, Signal,- Environment,+ Environment, Paths_xmobar, Plugins, Plugins.BufferedPipeReader, Plugins.CommandReader, Plugins.Date, Plugins.EWMH, Plugins.PipeReader, Plugins.MarqueePipeReader,@@ -203,7 +203,7 @@ cpp-options: -DUTF8 if flag(with_inotify) || flag(all_extensions)- build-depends: hinotify == 0.3.*+ build-depends: hinotify >= 0.3 && < 0.5 other-modules: Plugins.Mail, Plugins.MBox cpp-options: -DINOTIFY