aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Prompt/RunOrRaise.hs
diff options
context:
space:
mode:
authorDaniel Wagner <daniel@wagner-home.com>2011-07-31 19:08:50 +0200
committerDaniel Wagner <daniel@wagner-home.com>2011-07-31 19:08:50 +0200
commit39f010d82d0292d9417a06abaf91dabb43ea3ef4 (patch)
tree1c701e3b4781a6460131c9e28e2705d8fb923f64 /XMonad/Prompt/RunOrRaise.hs
parent3eae9324c087da3fae57f2dcd9181eb850f12c1a (diff)
downloadXMonadContrib-39f010d82d0292d9417a06abaf91dabb43ea3ef4.tar.gz
XMonadContrib-39f010d82d0292d9417a06abaf91dabb43ea3ef4.tar.xz
XMonadContrib-39f010d82d0292d9417a06abaf91dabb43ea3ef4.zip
GHC 7 compat
Ignore-this: 17a43a709e70ebccc925e016d7057399 * true error: more modules export foldl/foldl'/foldr, so explicitly use the Data.Foldable one * -Werror error: transition from Control.OldException to Control.Exception, assuming everything was IOException darcs-hash:20110731170850-76d51-71271524485f6d10f84521f271182bea5085d400.gz
Diffstat (limited to 'XMonad/Prompt/RunOrRaise.hs')
-rw-r--r--XMonad/Prompt/RunOrRaise.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/XMonad/Prompt/RunOrRaise.hs b/XMonad/Prompt/RunOrRaise.hs
index 5fcfb3a..251e09c 100644
--- a/XMonad/Prompt/RunOrRaise.hs
+++ b/XMonad/Prompt/RunOrRaise.hs
@@ -25,9 +25,14 @@ import XMonad.Prompt.Shell
import XMonad.Actions.WindowGo (runOrRaise)
import XMonad.Util.Run (runProcessWithInput)
+import Prelude hiding (catch)
+import Control.Exception
import Control.Monad (liftM, liftM2)
import System.Directory (doesDirectoryExist, doesFileExist, executable, getPermissions)
+econst :: Monad m => a -> IOException -> m a
+econst = const . return
+
{- $usage
1. In your @~\/.xmonad\/xmonad.hs@:
@@ -65,7 +70,7 @@ isApp "thunderbird" = className =? "Thunderbird-bin" <||> className =? "Thunderb
isApp x = liftM2 (==) pid $ pidof x
pidof :: String -> Query Int
-pidof x = io $ (runProcessWithInput "pidof" [x] [] >>= readIO) `catch` (\_ -> return 0)
+pidof x = io $ (runProcessWithInput "pidof" [x] [] >>= readIO) `catch` econst 0
pid :: Query Int
pid = ask >>= (\w -> liftX $ withDisplay $ \d -> getPID d w)