Skip to content

Commit 0637f83

Browse files
author
Jude Taylor
committedFeb 15, 2017
update xmonad nix patch to apply to new xmonad
1 parent f56fa48 commit 0637f83

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,73 @@
1+
diff --git a/src/XMonad/Core.hs b/src/XMonad/Core.hs
2+
index 138d735..65b5a84 100644
13
--- a/src/XMonad/Core.hs
24
+++ 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)
46
import System.Process
57
import System.Directory
68
import System.Exit
79
+import System.Environment (lookupEnv)
810
import Graphics.X11.Xlib
9-
import Graphics.X11.Xlib.Extras (Event)
11+
import Graphics.X11.Xlib.Extras (getWindowAttributes, WindowAttributes, Event)
1012
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+
1517
+ ghc <- fromMaybe "ghc" <$> liftIO (lookupEnv "NIX_GHC")
1618
libTs <- mapM getModTime . Prelude.filter isSource =<< allFiles lib
1719
srcT <- getModTime src
1820
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
2627

2728
-- re-enable SIGCHLD:
28-
@@ -480,6 +482,7 @@ recompile force = io $ do
29+
installSignalHandlers
30+
@@ -594,6 +596,7 @@ recompile force = io $ do
2931
-- now, if it fails, run xmessage to let the user know:
3032
when (status /= ExitSuccess) $ do
3133
ghcErr <- readFile err
3234
+ xmessage <- fromMaybe "xmessage" <$> liftIO (lookupEnv "XMONAD_XMESSAGE")
3335
let msg = unlines $
3436
["Error detected while loading xmonad configuration file: " ++ src]
3537
++ 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
3739
-- nb, the ordering of printing, then forking, is crucial due to
3840
-- lazy evaluation
3941
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
4244
return ()
4345
return (status == ExitSuccess)
4446
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

Comments
 (0)
Please sign in to comment.