mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-30 02:23:46 -07:00
focusWindow: always view the containing workspace first
This commit is contained in:
13
StackSet.hs
13
StackSet.hs
@@ -248,19 +248,14 @@ focusRight = modify Empty $ \c -> case c of
|
|||||||
Node t ls [] -> Node x [] (xs ++ [t]) where (x:xs) = reverse ls
|
Node t ls [] -> Node x [] (xs ++ [t]) where (x:xs) = reverse ls
|
||||||
|
|
||||||
--
|
--
|
||||||
-- | /O(1) on current window, O(n) in general/. Focus the window 'w' on
|
-- | /O(1) on current window, O(n) in general/. Focus the window 'w'. If the
|
||||||
-- the current workspace. If 'w' isn't on the current workspace, leave
|
-- workspace 'w' is on is not visible, 'view' that workspace first.
|
||||||
-- the StackSet unmodified.
|
|
||||||
--
|
|
||||||
-- TODO: focusWindow give focus to any window on visible workspace
|
|
||||||
--
|
--
|
||||||
focusWindow :: (Integral i, Eq a) => a -> StackSet i a s -> StackSet i a s
|
focusWindow :: (Integral i, Eq a) => a -> StackSet i a s -> StackSet i a s
|
||||||
focusWindow w s | Just w == peek s = s
|
focusWindow w s | Just w == peek s = s
|
||||||
| otherwise = maybe s id $ do
|
| otherwise = maybe s id $ do
|
||||||
n <- findIndex w s -- TODO, needs to check visible workspaces
|
n <- findIndex w s
|
||||||
if n /= tag (current s) then Nothing -- not on this screen
|
return $ until ((Just w ==) . peek) focusLeft (view n s)
|
||||||
else return $ until ((Just w ==) . peek) focusLeft s
|
|
||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Finding if a window is in the stackset is a little tedious. We could
|
-- Finding if a window is in the stackset is a little tedious. We could
|
||||||
|
Reference in New Issue
Block a user