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]
}
(ekbs, missing) <- fmap filterExternal $ evalExternal $ externalBindings ts
mapM_ warnMissing missing
let missingErrs = warnMissing <$> missing
launch
$ ewmh
$ addKeymap ekbs
@ -84,7 +84,7 @@ main = do
, layoutHook = myLayouts
, manageHook = myManageHook
, handleEventHook = myEventHook
, startupHook = myStartupHook
, startupHook = myStartupHook missingErrs
, workspaces = myWorkspaces
, logHook = myLoghook h
, clickJustFocuses = False
@ -110,10 +110,15 @@ runCleanup ts = io $ do
--------------------------------------------------------------------------------
-- | 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?
myStartupHook :: X ()
myStartupHook = setDefaultCursor xC_left_ptr <+> docksStartupHook
myStartupHook :: [String] -> X ()
myStartupHook msgs = setDefaultCursor xC_left_ptr
<+> (io $ mapM_ print msgs)
<+> docksStartupHook
<+> startupHook def
--------------------------------------------------------------------------------

View File

@ -46,12 +46,12 @@ type MaybeX = MaybeExe X
type IOMaybeX = IO MaybeX
warnMissing :: Dependency -> IO ()
warnMissing :: Dependency -> String
warnMissing d = case d of
Required d' -> warn "required" d'
Optional d' -> warn "optional" d'
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 x = isJust <$> findExecutable x