summaryrefslogtreecommitdiffstats
path: root/XMonad/Operations.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@galois.com>2008-02-06 20:48:58 +0100
committerDon Stewart <dons@galois.com>2008-02-06 20:48:58 +0100
commit5bfcb6131b40139698d1f0ee7db4060f6facb034 (patch)
tree46720032c0fd32a95346f037ab14beb8a2696f82 /XMonad/Operations.hs
parentf79eb82479d91f6532d2108e7c0d1e04f7b05b95 (diff)
downloadmetatile-5bfcb6131b40139698d1f0ee7db4060f6facb034.tar
metatile-5bfcb6131b40139698d1f0ee7db4060f6facb034.zip
Lift initColor exceptions into Maybe
We should audit all X11 Haskell lib calls we make for whether they throw undocumented exceptions, and then banish that. darcs-hash:20080206194858-cba2c-143b6edd906a9ddfcc8ff85b4a42ebea0f3462bf
Diffstat (limited to 'XMonad/Operations.hs')
-rw-r--r--XMonad/Operations.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs
index 0e96893..46eebf8 100644
--- a/XMonad/Operations.hs
+++ b/XMonad/Operations.hs
@@ -31,8 +31,9 @@ import qualified Data.Map as M
import qualified Data.Set as S
import Control.Applicative
-import Control.Monad.State
import Control.Monad.Reader
+import Control.Monad.State
+import qualified Control.Exception as C
import System.IO
import Graphics.X11.Xlib
@@ -381,8 +382,9 @@ cleanMask km = do
return (complement (nlm .|. lockMask) .&. km)
-- | Get the Pixel value for a named color
-initColor :: Display -> String -> IO Pixel
-initColor dpy c = (color_pixel . fst) <$> allocNamedColor dpy colormap c
+initColor :: Display -> String -> IO (Maybe Pixel)
+initColor dpy c = C.handle (\_ -> return Nothing) $
+ (Just . color_pixel . fst) <$> allocNamedColor dpy colormap c
where colormap = defaultColormap dpy (defaultScreen dpy)
------------------------------------------------------------------------