summaryrefslogtreecommitdiffhomepage
path: root/src/Main.hs
diff options
context:
space:
mode:
authorJochen Keil <jochen.keil@gmail.com>2012-08-09 10:12:39 +0200
committerJochen Keil <jochen.keil@gmail.com>2012-08-09 10:46:18 +0200
commitfa4b999c73067cb55e316b94fe62aebb147cea98 (patch)
tree1a8ce7da66ca387c2c8dba61f540a362140104db /src/Main.hs
parent536273a9d980cf3e71d8d05813e18b3ebcaf9233 (diff)
downloadxmobar-fa4b999c73067cb55e316b94fe62aebb147cea98.tar.gz
xmobar-fa4b999c73067cb55e316b94fe62aebb147cea98.tar.bz2
Create signal handler in main and pass it down to the start* functions
This is necessary for setting up the signal callback (trigger) from the Plugin interface. As another benefit it is now possible to implement the lowerOnStart config option properly by simply sending a Hide signal in startLoop.
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Main.hs b/src/Main.hs
index 4c3f351..c7045b5 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -36,6 +36,8 @@ import System.Environment
import System.Posix.Files
import Control.Monad (unless)
+import Signal (setupSignalHandler, SignalType(..))
+
-- $main
-- | The main entry point
@@ -55,9 +57,10 @@ main = do
conf <- doOpts c o
fs <- initFont d (font conf)
cls <- mapM (parseTemplate conf) (splitTemplate conf)
- vars <- mapM (mapM startCommand) cls
+ sig <- setupSignalHandler
+ vars <- mapM (mapM $ startCommand sig) cls
(r,w) <- createWin d fs conf
- startLoop (XConf d r w fs conf) vars
+ startLoop (XConf d r w fs conf) sig vars
-- | Splits the template in its parts
splitTemplate :: Config -> [String]