diff options
author | Don Stewart <dons@cse.unsw.edu.au> | 2007-04-04 03:05:24 +0200 |
---|---|---|
committer | Don Stewart <dons@cse.unsw.edu.au> | 2007-04-04 03:05:24 +0200 |
commit | be4ba8554670804a4f7086c2dc618511026306d8 (patch) | |
tree | f1deccc7e6ac38be9728f43240ab67c41e122cb1 | |
parent | 95d72415b86cd4d3b8797c764f8075b4af505fea (diff) | |
download | metatile-be4ba8554670804a4f7086c2dc618511026306d8.tar metatile-be4ba8554670804a4f7086c2dc618511026306d8.zip |
replace multiple gets with a single get and record bind
darcs-hash:20070404010524-9c5c1-ae8b8c6a6e47d6676fb1fa77d800eb6485ac3424
-rw-r--r-- | Main.hs | 3 | ||||
-rw-r--r-- | Operations.hs | 25 |
2 files changed, 10 insertions, 18 deletions
@@ -169,8 +169,7 @@ handle e@(CrossingEvent {event_type = t}) -- configure a window handle e@(ConfigureRequestEvent {window = w}) = do - dpy <- gets display - ws <- gets workspace + XState { display = dpy, workspace = ws } <- get when (W.member w ws) $ -- already managed, reconfigure (see client:configure() trace ("Reconfigure already managed window: " ++ show w) diff --git a/Operations.hs b/Operations.hs index e2c2128..889d03c 100644 --- a/Operations.hs +++ b/Operations.hs @@ -25,12 +25,9 @@ import qualified StackSet as W -- screen and raises the window. refresh :: X () refresh = do - ws <- gets workspace - ws2sc <- gets wsOnScreen - xinesc <- gets xineScreens - d <- gets display - fls <- gets layoutDescs - dfltfl <- gets defaultLayoutDesc + XState {workspace = ws, wsOnScreen = ws2sc, xineScreens = xinesc + ,display = d ,layoutDescs = fls ,defaultLayoutDesc = dfltfl } <- get + flip mapM_ (M.assocs ws2sc) $ \(n, scn) -> do let sc = xinesc !! scn fl = M.findWithDefault dfltfl n fls @@ -156,8 +153,7 @@ safeFocus w = do ws <- gets workspace -- | Explicitly set the keyboard focus to the given window setFocus :: Window -> X () setFocus w = do - ws <- gets workspace - ws2sc <- gets wsOnScreen + XState { workspace = ws, wsOnScreen = ws2sc} <- get -- clear mouse button grab and border on other windows flip mapM_ (M.keys ws2sc) $ \n -> do @@ -204,8 +200,7 @@ kill = withDisplay $ \d -> do ws <- gets workspace whenJust (W.peek ws) $ \w -> do protocols <- io $ getWMProtocols d w - wmdelt <- gets wmdelete - wmprot <- gets wmprotocols + XState {wmdelete = wmdelt, wmprotocols = wmprot} <- get if wmdelt `elem` protocols then io $ allocaXEvent $ \ev -> do setEventType ev clientMessage @@ -227,8 +222,7 @@ tag o = do -- | view. Change the current workspace to workspce at offset 'n-1'. view :: Int -> X () view o = do - ws <- gets workspace - ws2sc <- gets wsOnScreen + XState { workspace = ws, wsOnScreen = ws2sc } <- get let m = W.current ws -- is the workspace we want to switch to currently visible? if M.member n ws2sc @@ -272,9 +266,8 @@ restart = do -- and -w options.) dmenu :: X () dmenu = do - xinesc <- gets xineScreens - ws <- gets workspace - ws2sc <- gets wsOnScreen + XState { xineScreens = xinesc, workspace = ws, wsOnScreen = ws2sc } <- get let curscreen = fromMaybe 0 (M.lookup (W.current ws) ws2sc) sc = xinesc !! curscreen - spawn $ "exe=`dmenu_path | dmenu -x " ++ (show $ rect_x sc) ++ " -w " ++ (show $ rect_width sc) ++ "` && exec $exe" + spawn $ concat [ "exe=`dmenu_path | dmenu -x ", show (rect_x sc) + , " -w " , show (rect_width sc) , "` && exec $exe" ] |