summaryrefslogtreecommitdiffstats
path: root/src/Much/Core.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Much/Core.hs')
-rw-r--r--src/Much/Core.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Much/Core.hs b/src/Much/Core.hs
index 353f248..e6dec8a 100644
--- a/src/Much/Core.hs
+++ b/src/Much/Core.hs
@@ -5,9 +5,11 @@
module Much.Core where
import Much.Action
+import Much.API
import Blessings.String (Blessings(Plain,SGR),pp)
import Control.Concurrent
import Control.Monad
+import Data.Functor
import Data.Time
import Much.Event
import Much.RenderTreeView (renderTreeView)
@@ -123,6 +125,7 @@ runState q0 = do
threadIds <- mapM forkIO
[ forever $ scan stdin >>= putEvent . EScan
+ , Much.API.main putEvent
]
winchHandler putEvent
@@ -173,6 +176,8 @@ processEvent q = \case
{ screenWidth = w, screenHeight = h
, flashMessage = Plain $ "resize " <> show (w,h)
}
+ EStateGet f ->
+ forkIO (f q) $> Right q
ev ->
return $ Right q
{ flashMessage = SGR [31,1] $ Plain $ "unhandled event: " <> show ev