|
| 1 | +diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs |
| 2 | +index 138d735..65b5a84 100644 |
1 | 3 | --- a/src/XMonad/Core.hs
|
2 | 4 | +++ b/src/XMonad/Core.hs
|
3 |
| -@@ -48,6 +48,7 @@ import System.Posix.Types (ProcessID) |
| 5 | +@@ -51,6 +51,7 @@ import System.Posix.Types (ProcessID) |
4 | 6 | import System.Process
|
5 | 7 | import System.Directory
|
6 | 8 | import System.Exit
|
7 | 9 | +import System.Environment (lookupEnv)
|
8 | 10 | import Graphics.X11.Xlib
|
9 |
| - import Graphics.X11.Xlib.Extras (Event) |
| 11 | + import Graphics.X11.Xlib.Extras (getWindowAttributes, WindowAttributes, Event) |
10 | 12 | import Data.Typeable
|
11 |
| -@@ -463,6 +464,7 @@ recompile force = io $ do |
12 |
| - err = base ++ ".errors" |
13 |
| - src = base ++ ".hs" |
14 |
| - lib = dir </> "lib" |
| 13 | +@@ -571,6 +572,7 @@ recompile force = io $ do |
| 14 | + lib = cfgdir </> "lib" |
| 15 | + buildscript = cfgdir </> "build" |
| 16 | + |
15 | 17 | + ghc <- fromMaybe "ghc" <$> liftIO (lookupEnv "NIX_GHC")
|
16 | 18 | libTs <- mapM getModTime . Prelude.filter isSource =<< allFiles lib
|
17 | 19 | srcT <- getModTime src
|
18 | 20 | binT <- getModTime bin
|
19 |
| -@@ -471,7 +473,7 @@ recompile force = io $ do |
20 |
| - -- temporarily disable SIGCHLD ignoring: |
21 |
| - uninstallSignalHandlers |
22 |
| - status <- bracket (openFile err WriteMode) hClose $ \h -> |
23 |
| -- waitForProcess =<< runProcess "ghc" ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-main-is", "main", "-v0", "-o",binn] (Just dir) |
24 |
| -+ waitForProcess =<< runProcess ghc ["--make", "xmonad.hs", "-i", "-ilib", "-fforce-recomp", "-main-is", "main", "-v0", "-o",binn] (Just dir) |
25 |
| - Nothing Nothing Nothing (Just h) |
| 21 | +@@ -586,7 +588,7 @@ recompile force = io $ do |
| 22 | + status <- bracket (openFile err WriteMode) hClose $ \errHandle -> |
| 23 | + waitForProcess =<< if useBuildscript |
| 24 | + then compileScript bin cfgdir buildscript errHandle |
| 25 | +- else compileGHC bin cfgdir errHandle |
| 26 | ++ else compileGHC ghc bin cfgdir errHandle |
26 | 27 |
|
27 | 28 | -- re-enable SIGCHLD:
|
28 |
| -@@ -480,6 +482,7 @@ recompile force = io $ do |
| 29 | + installSignalHandlers |
| 30 | +@@ -594,6 +596,7 @@ recompile force = io $ do |
29 | 31 | -- now, if it fails, run xmessage to let the user know:
|
30 | 32 | when (status /= ExitSuccess) $ do
|
31 | 33 | ghcErr <- readFile err
|
32 | 34 | + xmessage <- fromMaybe "xmessage" <$> liftIO (lookupEnv "XMONAD_XMESSAGE")
|
33 | 35 | let msg = unlines $
|
34 | 36 | ["Error detected while loading xmonad configuration file: " ++ src]
|
35 | 37 | ++ lines (if null ghcErr then show status else ghcErr)
|
36 |
| -@@ -487,7 +490,7 @@ recompile force = io $ do |
| 38 | +@@ -601,7 +604,7 @@ recompile force = io $ do |
37 | 39 | -- nb, the ordering of printing, then forking, is crucial due to
|
38 | 40 | -- lazy evaluation
|
39 | 41 | hPutStrLn stderr msg
|
40 |
| -- forkProcess $ executeFile "xmessage" True ["-default", "okay", msg] Nothing |
41 |
| -+ forkProcess $ executeFile xmessage True ["-default", "okay", msg] Nothing |
| 42 | +- forkProcess $ executeFile "xmessage" True ["-default", "okay", replaceUnicode msg] Nothing |
| 43 | ++ forkProcess $ executeFile xmessage True ["-default", "okay", replaceUnicode msg] Nothing |
42 | 44 | return ()
|
43 | 45 | return (status == ExitSuccess)
|
44 | 46 | else return True
|
| 47 | +@@ -619,16 +622,16 @@ recompile force = io $ do |
| 48 | + '\8216' -> '`' -- ‘ |
| 49 | + '\8217' -> '`' -- ’ |
| 50 | + _ -> c |
| 51 | +- compileGHC bin dir errHandle = |
| 52 | +- runProcess "ghc" ["--make" |
| 53 | +- , "xmonad.hs" |
| 54 | +- , "-i" |
| 55 | +- , "-ilib" |
| 56 | +- , "-fforce-recomp" |
| 57 | +- , "-main-is", "main" |
| 58 | +- , "-v0" |
| 59 | +- , "-o", bin |
| 60 | +- ] (Just dir) Nothing Nothing Nothing (Just errHandle) |
| 61 | ++ compileGHC ghc bin dir errHandle = |
| 62 | ++ runProcess ghc ["--make" |
| 63 | ++ , "xmonad.hs" |
| 64 | ++ , "-i" |
| 65 | ++ , "-ilib" |
| 66 | ++ , "-fforce-recomp" |
| 67 | ++ , "-main-is", "main" |
| 68 | ++ , "-v0" |
| 69 | ++ , "-o", bin |
| 70 | ++ ] (Just dir) Nothing Nothing Nothing (Just errHandle) |
| 71 | + compileScript bin dir script errHandle = |
| 72 | + runProcess script [bin] (Just dir) Nothing Nothing Nothing (Just errHandle) |
| 73 | + |
0 commit comments