2017-02-15 01:51:55 +01:00
|
|
|
|
diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs
|
|
|
|
|
index 138d735..65b5a84 100644
|
2015-12-22 18:02:15 +01:00
|
|
|
|
--- a/src/XMonad/Core.hs
|
|
|
|
|
+++ b/src/XMonad/Core.hs
|
2017-02-15 01:51:55 +01:00
|
|
|
|
@@ -51,6 +51,7 @@ import System.Posix.Types (ProcessID)
|
2013-12-12 22:33:51 +01:00
|
|
|
|
import System.Process
|
|
|
|
|
import System.Directory
|
|
|
|
|
import System.Exit
|
|
|
|
|
+import System.Environment (lookupEnv)
|
|
|
|
|
import Graphics.X11.Xlib
|
2017-02-15 01:51:55 +01:00
|
|
|
|
import Graphics.X11.Xlib.Extras (getWindowAttributes, WindowAttributes, Event)
|
2013-12-12 22:33:51 +01:00
|
|
|
|
import Data.Typeable
|
2017-02-15 01:51:55 +01:00
|
|
|
|
@@ -571,6 +572,7 @@ recompile force = io $ do
|
|
|
|
|
lib = cfgdir </> "lib"
|
|
|
|
|
buildscript = cfgdir </> "build"
|
|
|
|
|
|
2015-03-08 16:36:37 +01:00
|
|
|
|
+ ghc <- fromMaybe "ghc" <$> liftIO (lookupEnv "NIX_GHC")
|
2013-12-12 22:33:51 +01:00
|
|
|
|
libTs <- mapM getModTime . Prelude.filter isSource =<< allFiles lib
|
|
|
|
|
srcT <- getModTime src
|
|
|
|
|
binT <- getModTime bin
|
2017-02-15 01:51:55 +01:00
|
|
|
|
@@ -586,7 +588,7 @@ recompile force = io $ do
|
|
|
|
|
status <- bracket (openFile err WriteMode) hClose $ \errHandle ->
|
|
|
|
|
waitForProcess =<< if useBuildscript
|
|
|
|
|
then compileScript bin cfgdir buildscript errHandle
|
|
|
|
|
- else compileGHC bin cfgdir errHandle
|
|
|
|
|
+ else compileGHC ghc bin cfgdir errHandle
|
2013-12-12 22:33:51 +01:00
|
|
|
|
|
|
|
|
|
-- re-enable SIGCHLD:
|
2017-02-15 01:51:55 +01:00
|
|
|
|
installSignalHandlers
|
|
|
|
|
@@ -594,6 +596,7 @@ recompile force = io $ do
|
2013-12-12 22:33:51 +01:00
|
|
|
|
-- now, if it fails, run xmessage to let the user know:
|
|
|
|
|
when (status /= ExitSuccess) $ do
|
|
|
|
|
ghcErr <- readFile err
|
|
|
|
|
+ xmessage <- fromMaybe "xmessage" <$> liftIO (lookupEnv "XMONAD_XMESSAGE")
|
|
|
|
|
let msg = unlines $
|
|
|
|
|
["Error detected while loading xmonad configuration file: " ++ src]
|
|
|
|
|
++ lines (if null ghcErr then show status else ghcErr)
|
2017-02-15 01:51:55 +01:00
|
|
|
|
@@ -601,7 +604,7 @@ recompile force = io $ do
|
2013-12-12 22:33:51 +01:00
|
|
|
|
-- nb, the ordering of printing, then forking, is crucial due to
|
|
|
|
|
-- lazy evaluation
|
|
|
|
|
hPutStrLn stderr msg
|
2017-02-15 01:51:55 +01:00
|
|
|
|
- forkProcess $ executeFile "xmessage" True ["-default", "okay", replaceUnicode msg] Nothing
|
|
|
|
|
+ forkProcess $ executeFile xmessage True ["-default", "okay", replaceUnicode msg] Nothing
|
2013-12-12 22:33:51 +01:00
|
|
|
|
return ()
|
|
|
|
|
return (status == ExitSuccess)
|
|
|
|
|
else return True
|
2017-02-15 01:51:55 +01:00
|
|
|
|
@@ -619,16 +622,16 @@ recompile force = io $ do
|
|
|
|
|
'\8216' -> '`' -- ‘
|
|
|
|
|
'\8217' -> '`' -- ’
|
|
|
|
|
_ -> c
|
|
|
|
|
- compileGHC bin dir errHandle =
|
|
|
|
|
- runProcess "ghc" ["--make"
|
|
|
|
|
- , "xmonad.hs"
|
|
|
|
|
- , "-i"
|
|
|
|
|
- , "-ilib"
|
|
|
|
|
- , "-fforce-recomp"
|
|
|
|
|
- , "-main-is", "main"
|
|
|
|
|
- , "-v0"
|
|
|
|
|
- , "-o", bin
|
|
|
|
|
- ] (Just dir) Nothing Nothing Nothing (Just errHandle)
|
|
|
|
|
+ compileGHC ghc bin dir errHandle =
|
|
|
|
|
+ runProcess ghc ["--make"
|
|
|
|
|
+ , "xmonad.hs"
|
|
|
|
|
+ , "-i"
|
|
|
|
|
+ , "-ilib"
|
|
|
|
|
+ , "-fforce-recomp"
|
|
|
|
|
+ , "-main-is", "main"
|
|
|
|
|
+ , "-v0"
|
|
|
|
|
+ , "-o", bin
|
|
|
|
|
+ ] (Just dir) Nothing Nothing Nothing (Just errHandle)
|
|
|
|
|
compileScript bin dir script errHandle =
|
|
|
|
|
runProcess script [bin] (Just dir) Nothing Nothing Nothing (Just errHandle)
|
|
|
|
|
|