FIX actually print errors

This commit is contained in:
Nathan Dwarshuis 2021-06-19 16:16:00 -04:00
parent a04150657e
commit e8a1b1150b
2 changed files with 11 additions and 6 deletions

View File

@ -75,7 +75,7 @@ main = do
, childHandles = [h] , childHandles = [h]
} }
(ekbs, missing) <- fmap filterExternal $ evalExternal $ externalBindings ts (ekbs, missing) <- fmap filterExternal $ evalExternal $ externalBindings ts
mapM_ warnMissing missing let missingErrs = warnMissing <$> missing
launch launch
$ ewmh $ ewmh
$ addKeymap ekbs $ addKeymap ekbs
@ -84,7 +84,7 @@ main = do
, layoutHook = myLayouts , layoutHook = myLayouts
, manageHook = myManageHook , manageHook = myManageHook
, handleEventHook = myEventHook , handleEventHook = myEventHook
, startupHook = myStartupHook , startupHook = myStartupHook missingErrs
, workspaces = myWorkspaces , workspaces = myWorkspaces
, logHook = myLoghook h , logHook = myLoghook h
, clickJustFocuses = False , clickJustFocuses = False
@ -110,10 +110,15 @@ runCleanup ts = io $ do
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- | Startuphook configuration -- | Startuphook configuration
--
-- For some reason I can't print error messages (perhaps a buffering/flushing
-- problem) outside the 'launch' function so pass them here to be printed.
-- TODO add _NET_DESKTOP_VIEWPORTS to _NET_SUPPORTED? -- TODO add _NET_DESKTOP_VIEWPORTS to _NET_SUPPORTED?
myStartupHook :: X () myStartupHook :: [String] -> X ()
myStartupHook = setDefaultCursor xC_left_ptr <+> docksStartupHook myStartupHook msgs = setDefaultCursor xC_left_ptr
<+> (io $ mapM_ print msgs)
<+> docksStartupHook
<+> startupHook def <+> startupHook def
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -46,12 +46,12 @@ type MaybeX = MaybeExe X
type IOMaybeX = IO MaybeX type IOMaybeX = IO MaybeX
warnMissing :: Dependency -> IO () warnMissing :: Dependency -> String
warnMissing d = case d of warnMissing d = case d of
Required d' -> warn "required" d' Required d' -> warn "required" d'
Optional d' -> warn "optional" d' Optional d' -> warn "optional" d'
where where
warn t n = putStrLn $ "WARNING: " ++ t ++ " executable not found: " ++ n warn t n = "WARNING: " ++ t ++ " executable not found: " ++ n
exeInstalled :: String -> IO Bool exeInstalled :: String -> IO Bool
exeInstalled x = isJust <$> findExecutable x exeInstalled x = isJust <$> findExecutable x