summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ProcessWorkspaces.hs19
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/ProcessWorkspaces.hs b/lib/ProcessWorkspaces.hs
index 69ab48d..0cb65ab 100644
--- a/lib/ProcessWorkspaces.hs
+++ b/lib/ProcessWorkspaces.hs
@@ -18,8 +18,6 @@ import Graphics.X11.Types (Window)
import System.Posix.Process (getProcessPriority)
import System.Posix.Types (ProcessID)
-import Prelude hiding ( catch )
-import Control.OldException (catch)
import Control.Monad
import Data.Maybe
import Data.Monoid
@@ -31,14 +29,11 @@ import Storage
moveWindowHook :: ManageHook
moveWindowHook = do
mp <- pid
- io $ appendFile "/tmp/test" $ "Pid: " ++ show mp ++ "\n"
case mp of
Just p -> do
mws <- liftX $ getProcessWorkspace p
- io $ appendFile "/tmp/test" $ "WS: " ++ show mws ++ "\n"
case mws of
- Just ws -> do
- io $ appendFile "/tmp/test" $ show ws ++ "\n"
+ Just ws ->
doShift ws
_ ->
idHook
@@ -55,11 +50,9 @@ processWorkspaceStorage = storage $ ProcessWorkspaceStoreData M.empty
setProcessWorkspace :: ProcessID -> WorkspaceId -> X ()
setProcessWorkspace pid ws = do
- io $ appendFile "/tmp/test" $ "Added " ++ show (pid, ws) ++ "\n"
ProcessWorkspaceStoreData map <- liftM (fromMaybe $ ProcessWorkspaceStoreData M.empty) $ getStoreData
map' <- filterPIDMap $ M.insert pid ws map
setStoreData $ ProcessWorkspaceStoreData map'
- io (appendFile "/tmp/test" $ show map' ++ "\n")
getProcessWorkspace :: ProcessID -> X (Maybe WorkspaceId)
getProcessWorkspace pid = getStoreData >>= return . join . fmap (\(ProcessWorkspaceStoreData map) -> M.lookup pid map)
@@ -74,16 +67,8 @@ spawnOnCurrent :: String -> X ()
spawnOnCurrent x = gets (W.currentTag . windowset) >>= \ws -> spawnOn ws x
-catchX' :: X a -> X a -> X a
-catchX' job errcase = do
- st <- get
- c <- ask
- (a, s') <- io $ runX c st job `catch` \_ -> runX c st errcase
- put s'
- return a
-
filterPIDMap :: M.Map ProcessID a -> X (M.Map ProcessID a)
filterPIDMap = liftM M.fromAscList . filterM (pidExists . fst) . M.toAscList
where
pidExists :: ProcessID -> X Bool
- pidExists pid = catchX' (io (getProcessPriority pid) >> return True) (return False)
+ pidExists pid = io $ ((getProcessPriority pid) >> return True) `catch` (\_ -> return False)