summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Mail.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/Mail.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/Mail.hs')
-rw-r--r--src/Plugins/Mail.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Plugins/Mail.hs b/src/Plugins/Mail.hs
index d146d17..d4abb0b 100644
--- a/src/Plugins/Mail.hs
+++ b/src/Plugins/Mail.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Plugins.Mail
@@ -15,6 +16,7 @@
module Plugins.Mail where
import Plugins
+#ifdef INOTIFY
import Plugins.Utils (expandHome, changeLoop)
import Control.Monad
@@ -27,6 +29,10 @@ import System.INotify
import Data.List (isPrefixOf)
import Data.Set (Set)
import qualified Data.Set as S
+#else
+import System.IO
+#endif
+
-- | A list of mail box names and paths to maildirs.
data Mail = Mail [(String, FilePath)] String
@@ -34,6 +40,11 @@ data Mail = Mail [(String, FilePath)] String
instance Exec Mail where
alias (Mail _ a) = a
+#ifndef INOTIFY
+ start _ _ = do
+ hPutStrLn stderr $ "Warning: xmobar is not compiled with -fwith_inotify,"
+ ++ " but the Mail plugin requires it."
+#else
start (Mail ms _) cb = do
vs <- mapM (const $ newTVarIO S.empty) ms
@@ -65,3 +76,4 @@ handle v e = atomically $ modifyTVar v $ case e of
where
delete = S.delete (filePath e)
create = S.insert (filePath e)
+#endif