summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--XMonad.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/XMonad.hs b/XMonad.hs
index e08956d..4309fe1 100644
--- a/XMonad.hs
+++ b/XMonad.hs
@@ -17,7 +17,7 @@
module XMonad (
X, WindowSet, WorkspaceId(..), ScreenId(..), XState(..), XConf(..), Layout(..),
Typeable, Message, SomeMessage(..), fromMessage,
- runX, io, withDisplay, withWindowSet, isRoot, spawn, restart, trace, whenJust, whenX,
+ runX, io, safeIO, withDisplay, withWindowSet, isRoot, spawn, restart, trace, whenJust, whenX,
atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW
) where
@@ -137,6 +137,9 @@ fromMessage (SomeMessage m) = cast m
io :: IO a -> X a
io = liftIO
+safeIO :: IO () -> X ()
+safeIO f = liftIO (f `catch` \e -> do hPutStrLn stderr (show e); hFlush stderr)
+
-- | spawn. Launch an external application
spawn :: String -> X ()
spawn x = io $ do