From dc670b15ba8b279e1119ac895dd681feab4e3939 Mon Sep 17 00:00:00 2001 From: Adam Vogt Date: Tue, 25 Feb 2014 01:27:03 -0500 Subject: have disabled plugins still accept input This change lets xmobar compiled without -fwith_inotify accept a config that mentions the Mail plugin with a warning (and display an Updating...). --- src/Plugins/MBox.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/Plugins/MBox.hs') diff --git a/src/Plugins/MBox.hs b/src/Plugins/MBox.hs index c4335f7..d9a9765 100644 --- a/src/Plugins/MBox.hs +++ b/src/Plugins/MBox.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Plugins.MBox @@ -16,6 +17,7 @@ module Plugins.MBox (MBox(..)) where import Prelude import Plugins +#ifdef INOTIFY import Plugins.Utils (changeLoop, expandHome) import Control.Monad (when) @@ -57,6 +59,10 @@ parseOptions args = (o, _, []) -> return $ foldr id defaults o (_, _, errs) -> ioError . userError $ concat errs +#else +import System.IO +#endif + -- | A list of display names, paths to mbox files and display colours, -- followed by a list of options. data MBox = MBox [(String, FilePath, String)] [String] String @@ -64,8 +70,12 @@ data MBox = MBox [(String, FilePath, String)] [String] String instance Exec MBox where alias (MBox _ _ a) = a +#ifndef INOTIFY + start _ _ = do + hPutStrLn stderr $ "Warning: xmobar is not compiled with -fwith_inotify" ++ + " but the MBox plugin requires it" +#else start (MBox boxes args _) cb = do - opts <- parseOptions args let showAll = oAll opts prefix = oPrefix opts @@ -109,3 +119,4 @@ handleNotification v _ = do (p, _) <- atomically $ readTVar v n <- countMails p atomically $ writeTVar v (p, n) +#endif -- cgit v1.2.3