aboutsummaryrefslogtreecommitdiffstats
path: root/StackSet.hs
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-05-21 05:55:51 +0200
committerJason Creighton <jcreigh@gmail.com>2007-05-21 05:55:51 +0200
commit53c1c644993000c9c6f410cc57e0d7995a12b3cf (patch)
treeb05d6962a7c346ae1d6d477bebac5e7eb42b32ec /StackSet.hs
parente7d0961f0d411ca33c68c50f3477978df846cfe9 (diff)
downloadxmonad-53c1c644993000c9c6f410cc57e0d7995a12b3cf.tar.gz
xmonad-53c1c644993000c9c6f410cc57e0d7995a12b3cf.tar.xz
xmonad-53c1c644993000c9c6f410cc57e0d7995a12b3cf.zip
focusWindow: always view the containing workspace first
darcs-hash:20070521035551-b9aa7-d33479e88029b33748dd48607b51fac22343168c.gz
Diffstat (limited to 'StackSet.hs')
-rw-r--r--StackSet.hs13
1 files changed, 4 insertions, 9 deletions
diff --git a/StackSet.hs b/StackSet.hs
index f5d04db..9401bbc 100644
--- a/StackSet.hs
+++ b/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
--
--- | /O(1) on current window, O(n) in general/. Focus the window 'w' on
--- the current workspace. If 'w' isn't on the current workspace, leave
--- the StackSet unmodified.
---
--- TODO: focusWindow give focus to any window on visible workspace
+-- | /O(1) on current window, O(n) in general/. Focus the window 'w'. If the
+-- workspace 'w' is on is not visible, 'view' that workspace first.
--
focusWindow :: (Integral i, Eq a) => a -> StackSet i a s -> StackSet i a s
focusWindow w s | Just w == peek s = s
| otherwise = maybe s id $ do
- n <- findIndex w s -- TODO, needs to check visible workspaces
- if n /= tag (current s) then Nothing -- not on this screen
- else return $ until ((Just w ==) . peek) focusLeft s
-
+ n <- findIndex w s
+ return $ until ((Just w ==) . peek) focusLeft (view n s)
--
-- Finding if a window is in the stackset is a little tedious. We could