ui: oops, watch files only with --watch flag
This commit is contained in:
parent
8566dedc57
commit
1735b62011
@ -149,10 +149,15 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
|||||||
, appDraw = \ui -> sDraw (aScreen ui) ui
|
, appDraw = \ui -> sDraw (aScreen ui) ui
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not (watch_ uopts')
|
||||||
|
then
|
||||||
|
void $ defaultMain brickapp ui
|
||||||
|
|
||||||
|
else
|
||||||
-- start one or more background jobs reporting changes in the directories of our files
|
-- start one or more background jobs reporting changes in the directories of our files
|
||||||
-- XXX misses quick successive saves (then refuses to reload manually)
|
-- XXX misses quick successive saves (still ? hard to reproduce now)
|
||||||
|
-- XXX then refuses to reload manually (should be fixed now ?)
|
||||||
-- withManagerConf defaultConfig{confDebounce=Debounce 1000} $ \mgr -> do
|
-- withManagerConf defaultConfig{confDebounce=Debounce 1000} $ \mgr -> do
|
||||||
eventChan <- newChan
|
|
||||||
withManager $ \mgr -> do
|
withManager $ \mgr -> do
|
||||||
dbg1IO "fsnotify using polling ?" $ isPollingManager mgr
|
dbg1IO "fsnotify using polling ?" $ isPollingManager mgr
|
||||||
files <- mapM canonicalizePath $ map fst $ jfiles j
|
files <- mapM canonicalizePath $ map fst $ jfiles j
|
||||||
@ -160,6 +165,8 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
|||||||
dbg1IO "files" files
|
dbg1IO "files" files
|
||||||
dbg1IO "directories to watch" directories
|
dbg1IO "directories to watch" directories
|
||||||
|
|
||||||
|
eventChan <- newChan
|
||||||
|
|
||||||
forM_ directories $ \d -> watchDir
|
forM_ directories $ \d -> watchDir
|
||||||
mgr
|
mgr
|
||||||
d
|
d
|
||||||
@ -176,7 +183,7 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
|||||||
writeChan eventChan FileChange
|
writeChan eventChan FileChange
|
||||||
)
|
)
|
||||||
|
|
||||||
-- start the brick app. Must be inside the withManager block.
|
-- must be inside the withManager block
|
||||||
void $ customMain (mkVty def) (Just eventChan) brickapp ui
|
void $ customMain (mkVty def) (Just eventChan) brickapp ui
|
||||||
|
|
||||||
showFSNEvent (Added f _) = "Added " ++ show f
|
showFSNEvent (Added f _) = "Added " ++ show f
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user