summaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Main.hsc19
1 files changed, 12 insertions, 7 deletions
diff --git a/XMonad/Main.hsc b/XMonad/Main.hsc
index 945c5ea..454a3e6 100644
--- a/XMonad/Main.hsc
+++ b/XMonad/Main.hsc
@@ -65,6 +65,18 @@ xmonad initxmc = do
let dflt = defaultScreen dpy
rootw <- rootWindow dpy dflt
+
+ -- If another WM is running, a BadAccess error will be returned. The
+ -- default error handler will write the exception to stderr and exit with
+ -- an error.
+ selectInput dpy rootw $ substructureRedirectMask .|. substructureNotifyMask
+ .|. enterWindowMask .|. leaveWindowMask .|. structureNotifyMask
+ sync dpy False -- sync to ensure all outstanding errors are delivered
+
+ -- turn off the default handler in favor of one that ignores all errors
+ -- (ugly, I know)
+ xSetErrorHandler -- in C, I'm too lazy to write the binding: dons
+
xinesc <- getCleanedScreenInfo dpy
nbc <- do v <- initColor dpy $ normalBorderColor xmc
~(Just nbc_) <- initColor dpy $ normalBorderColor Default.defaultConfig
@@ -107,13 +119,6 @@ xmonad initxmc = do
, waitingUnmap = M.empty
, dragging = Nothing }
- xSetErrorHandler -- in C, I'm too lazy to write the binding: dons
-
- -- setup initial X environment
- sync dpy False
- selectInput dpy rootw $ substructureRedirectMask .|. substructureNotifyMask
- .|. enterWindowMask .|. leaveWindowMask .|. structureNotifyMask
-
allocaXEvent $ \e ->
runX cf st $ do