summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/MBox.hs
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2014-02-25 01:27:03 -0500
committerAdam Vogt <vogt.adam@gmail.com>2014-02-25 12:29:04 -0500
commitdc670b15ba8b279e1119ac895dd681feab4e3939 (patch)
tree59ac3f96a4ab84bf43af7d88dc256d4353d258d1 /src/Plugins/MBox.hs
parentb739857ed4d2282e80a8908165ffda82fcc3ecdc (diff)
downloadxmobar-dc670b15ba8b279e1119ac895dd681feab4e3939.tar.gz
xmobar-dc670b15ba8b279e1119ac895dd681feab4e3939.tar.bz2
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...).
Diffstat (limited to 'src/Plugins/MBox.hs')
-rw-r--r--src/Plugins/MBox.hs13
1 files changed, 12 insertions, 1 deletions
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