diff options
author | Don Stewart <dons@galois.com> | 2007-09-27 23:39:37 +0200 |
---|---|---|
committer | Don Stewart <dons@galois.com> | 2007-09-27 23:39:37 +0200 |
commit | d9ff9d1fbcba0cb7b006bdd5d410e131157a2635 (patch) | |
tree | 5b4e05656bf8ad0dedcc7969972689adc823c049 | |
parent | 80495f9d725de9dc387659e4571eca41edc1e1c5 (diff) | |
download | xmonad-d9ff9d1fbcba0cb7b006bdd5d410e131157a2635.tar.gz xmonad-d9ff9d1fbcba0cb7b006bdd5d410e131157a2635.tar.xz xmonad-d9ff9d1fbcba0cb7b006bdd5d410e131157a2635.zip |
Add StackSet.focusMaster (mod-m) to move focus to master
darcs-hash:20070927213937-cba2c-9b0d13cac79e9fb142c3a97cc6569f8a15297603.gz
-rw-r--r-- | Config.hs | 2 | ||||
-rw-r--r-- | StackSet.hs | 21 |
2 files changed, 16 insertions, 7 deletions
@@ -143,6 +143,8 @@ keys = M.fromList $ , ((modMask, xK_Tab ), windows W.focusDown) -- %! Move focus to the next window , ((modMask, xK_j ), windows W.focusDown) -- %! Move focus to the next window , ((modMask, xK_k ), windows W.focusUp ) -- %! Move focus to the previous window + , ((modMask, xK_m ), windows W.focusMaster ) -- %! Move focus to the master window + -- modifying the window order , ((modMask, xK_Return), windows W.swapMaster) -- %! Swap the focused window and the master window diff --git a/StackSet.hs b/StackSet.hs index 7a4c392..8e806d4 100644 --- a/StackSet.hs +++ b/StackSet.hs @@ -23,14 +23,14 @@ module StackSet ( -- * Operations on the current stack -- $stackOperations peek, index, integrate, integrate', differentiate, - focusUp, focusDown, + focusUp, focusDown, focusMaster, focusWindow, tagMember, member, findIndex, -- * Modifying the stackset -- $modifyStackset insertUp, delete, delete', filter, -- * Setting the master window -- $settingMW - swapMaster, swapUp, swapDown, modify, modify', float, sink, -- needed by users + swapUp, swapDown, swapMaster, modify, modify', float, sink, -- needed by users -- * Composite operations -- $composite shift, shiftWin @@ -463,11 +463,11 @@ delete w = sink w . delete' w -- | Only temporarily remove the window from the stack, thereby not destroying special -- information saved in the Stackset delete' :: (Ord a, Eq s) => a -> StackSet i a s sd -> StackSet i a s sd -delete' w s = s { current = removeFromScreen (current s) - , visible = map removeFromScreen (visible s) - , hidden = map removeFromWorkspace (hidden s) } +delete' w s = s { current = removeFromScreen (current s) + , visible = map removeFromScreen (visible s) + , hidden = map removeFromWorkspace (hidden s) } where removeFromWorkspace ws = ws { stack = stack ws >>= filter (/=w) } - removeFromScreen scr = scr { workspace = removeFromWorkspace (workspace scr) } + removeFromScreen scr = scr { workspace = removeFromWorkspace (workspace scr) } ------------------------------------------------------------------------ @@ -489,9 +489,16 @@ sink w s = s { floating = M.delete w (floating s) } swapMaster :: StackSet i a s sd -> StackSet i a s sd swapMaster = modify' $ \c -> case c of Stack _ [] _ -> c -- already master. - Stack t ls rs -> Stack t [] (ys ++ x : rs) where (x:ys) = reverse ls + Stack t ls rs -> Stack t [] (xs ++ x : rs) where (x:xs) = reverse ls -- natural! keep focus, move current to the top, move top to current. + +-- | /O(s)/. Set focus to the master window. +focusMaster :: StackSet i a s sd -> StackSet i a s sd +focusMaster = modify' $ \c -> case c of + Stack _ [] _ -> c + Stack t ls rs -> Stack x [] (xs ++ t : rs) where (x:xs) = reverse ls + -- -- --------------------------------------------------------------------- -- $composite |