blob: a4ced9f8f53fdd49964f369b98cb6d70e76a8427 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
module Daffm (initApp, loadDirToState, mkEmptyAppState) where
import qualified Brick.Main as B
import Control.Monad (void)
import Daffm.Attrs (appAttrMap)
import Daffm.Event (appEvent)
import Daffm.State (loadDirToState, mkEmptyAppState)
import Daffm.Types (AppState (..), Configuration, FilePathText, FocusTarget)
import Daffm.View (appView)
app :: B.App AppState e FocusTarget
app =
B.App
{ B.appDraw = appView,
B.appChooseCursor = B.showFirstCursor,
B.appHandleEvent = appEvent,
B.appStartEvent = pure (),
B.appAttrMap = const appAttrMap
}
initApp :: FilePathText -> Configuration -> IO ()
initApp dir config = do
initialState <- loadDirToState dir $ mkEmptyAppState config
void $ B.defaultMain app initialState
|