summaryrefslogtreecommitdiffstats
path: root/src/Much/Core.hs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-05-14 22:51:18 +0200
committertv <tv@krebsco.de>2020-09-29 19:35:31 +0200
commit8d5e610b4caee7cb184294ca22f527f9f6934b82 (patch)
treeb1d95305dbf3a4134226c868798c125d06b8a863 /src/Much/Core.hs
parent8e92e6e11d2b3b0bfb5ac9d68f347219493e6380 (diff)
Much.API: init
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