From e8a1b1150bc30df461f31dd5ad5dd4628ed31980 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sat, 19 Jun 2021 16:16:00 -0400 Subject: [PATCH] FIX actually print errors --- bin/xmonad.hs | 13 +++++++++---- lib/XMonad/Internal/Shell.hs | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/xmonad.hs b/bin/xmonad.hs index b06fd2e..e0369da 100644 --- a/bin/xmonad.hs +++ b/bin/xmonad.hs @@ -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 -------------------------------------------------------------------------------- diff --git a/lib/XMonad/Internal/Shell.hs b/lib/XMonad/Internal/Shell.hs index 870cadb..0df66f8 100644 --- a/lib/XMonad/Internal/Shell.hs +++ b/lib/XMonad/Internal/Shell.hs @@ -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