mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 08:30:21 -07:00
refactored "focus changed" code into "refocus"
This commit is contained in:
parent
a5e3f1daa0
commit
207bd516e1
1
Main.hs
1
Main.hs
@ -127,6 +127,7 @@ safeFocus w = do ws <- gets workspace
|
|||||||
then setFocus w
|
then setFocus w
|
||||||
else do b <- isRoot w
|
else do b <- isRoot w
|
||||||
when b setTopFocus
|
when b setTopFocus
|
||||||
|
refocus
|
||||||
|
|
||||||
handle :: Event -> X ()
|
handle :: Event -> X ()
|
||||||
|
|
||||||
|
@ -41,9 +41,6 @@ refresh = do
|
|||||||
fl = M.findWithDefault dfltfl n fls
|
fl = M.findWithDefault dfltfl n fls
|
||||||
l = layoutType fl
|
l = layoutType fl
|
||||||
ratio = tileFraction fl
|
ratio = tileFraction fl
|
||||||
mapM_ (setButtonGrab True) (W.index n ws)
|
|
||||||
when (n == W.current ws) $
|
|
||||||
maybe (return ()) (setButtonGrab False) (W.peekStack n ws)
|
|
||||||
case l of
|
case l of
|
||||||
Full -> whenJust (W.peekStack n ws) $ \w -> do
|
Full -> whenJust (W.peekStack n ws) $ \w -> do
|
||||||
move w sx sy sw sh
|
move w sx sy sw sh
|
||||||
@ -59,6 +56,16 @@ refresh = do
|
|||||||
zipWithM_ (\i a -> move a (sx + lw) (sy + i * rh) rw (fromIntegral rh)) [0..] s
|
zipWithM_ (\i a -> move a (sx + lw) (sy + i * rh) rw (fromIntegral rh)) [0..] s
|
||||||
whenJust (W.peek ws) (io . raiseWindow d) -- this is always Just
|
whenJust (W.peek ws) (io . raiseWindow d) -- this is always Just
|
||||||
whenJust (W.peek ws) setFocus
|
whenJust (W.peek ws) setFocus
|
||||||
|
refocus
|
||||||
|
|
||||||
|
refocus :: X ()
|
||||||
|
refocus = do
|
||||||
|
ws2sc <- gets wsOnScreen
|
||||||
|
ws <- gets workspace
|
||||||
|
flip mapM_ (M.keys ws2sc) $ \n -> do
|
||||||
|
mapM_ (setButtonGrab True) (W.index n ws)
|
||||||
|
when (n == W.current ws) $
|
||||||
|
maybe (return ()) (setButtonGrab False) (W.peekStack n ws)
|
||||||
|
|
||||||
-- | switchLayout. Switch to another layout scheme. Switches the current workspace.
|
-- | switchLayout. Switch to another layout scheme. Switches the current workspace.
|
||||||
switchLayout :: X ()
|
switchLayout :: X ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user