diff options
author | Jan Vornberger <jan.vornberger@informatik.uni-oldenburg.de> | 2009-10-16 01:35:18 +0200 |
---|---|---|
committer | Jan Vornberger <jan.vornberger@informatik.uni-oldenburg.de> | 2009-10-16 01:35:18 +0200 |
commit | 067378acdce28d7426531c13c2ca979ac74b79c3 (patch) | |
tree | f29cf4cf6269fae87e150c7176b38554ba1efe71 /XMonad/Layout | |
parent | e1295ab77d0dfc6f77321031db90222419805b2c (diff) | |
download | XMonadContrib-067378acdce28d7426531c13c2ca979ac74b79c3.tar.gz XMonadContrib-067378acdce28d7426531c13c2ca979ac74b79c3.tar.xz XMonadContrib-067378acdce28d7426531c13c2ca979ac74b79c3.zip |
Added focusMaster to BoringWindows
Ignore-this: 7f99337fc63cdc7c861fdc3c2ab2d3d1
darcs-hash:20091015233518-594c5-e40708ea385489bfe10b8af9fc2731fd7dc62718.gz
Diffstat (limited to 'XMonad/Layout')
-rw-r--r-- | XMonad/Layout/BoringWindows.hs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/XMonad/Layout/BoringWindows.hs b/XMonad/Layout/BoringWindows.hs index f56a004..9f84e96 100644 --- a/XMonad/Layout/BoringWindows.hs +++ b/XMonad/Layout/BoringWindows.hs @@ -19,7 +19,7 @@ module XMonad.Layout.BoringWindows ( -- $usage boringWindows, boringAuto, markBoring, clearBoring, - focusUp, focusDown, + focusUp, focusDown, focusMaster, UpdateBoring(UpdateBoring), BoringMessage(Replace,Merge), @@ -52,14 +52,15 @@ import qualified XMonad.StackSet as W -- Then to your keybindings, add: -- -- > , ((modMask, xK_j), focusUp) --- > , ((modMask, xk_k), focusDown) +-- > , ((modMask, xK_k), focusDown) +-- > , ((modMask, xK_m), focusMaster) -- -- For more detailed instructions on editing the layoutHook see: -- -- "XMonad.Doc.Extending#Editing_the_layout_hook" -data BoringMessage = FocusUp | FocusDown | IsBoring Window | ClearBoring +data BoringMessage = FocusUp | FocusDown | FocusMaster | IsBoring Window | ClearBoring | Replace String [Window] | Merge String [Window] deriving ( Read, Show, Typeable ) @@ -72,11 +73,12 @@ data UpdateBoring = UpdateBoring deriving (Typeable) instance Message UpdateBoring -markBoring, clearBoring, focusUp, focusDown :: X () +markBoring, clearBoring, focusUp, focusDown, focusMaster :: X () markBoring = withFocused (sendMessage . IsBoring) clearBoring = sendMessage ClearBoring focusUp = sendMessage UpdateBoring >> sendMessage FocusUp focusDown = sendMessage UpdateBoring >> sendMessage FocusDown +focusMaster = sendMessage UpdateBoring >> sendMessage FocusMaster data BoringWindows a = BoringWindows { namedBoring :: M.Map String [a] -- ^ store borings with a specific source @@ -115,6 +117,12 @@ instance LayoutModifier BoringWindows Window where | Just FocusDown <- fromMessage m = do windows $ W.modify' $ skipBoring W.focusDown' return Nothing + | Just FocusMaster <- fromMessage m = + do windows $ W.modify' + $ skipBoring W.focusDown' -- wiggle focus to make sure + . skipBoring W.focusUp' -- no boring window gets the focus + . focusMaster' + return Nothing where skipBoring f st = fromMaybe st $ listToMaybe $ filter ((`notElem` W.focus st:bs) . W.focus) $ take (length $ W.integrate st) @@ -122,3 +130,9 @@ instance LayoutModifier BoringWindows Window where bs = concat $ cbs:maybeToList lbs ++ M.elems nbs rjl = return . Just . Left handleMessOrMaybeModifyIt _ _ = return Nothing + +-- | Variant of 'focusMaster' that works on a +-- 'Stack' rather than an entire 'StackSet'. +focusMaster' :: W.Stack a -> W.Stack a +focusMaster' c@(W.Stack _ [] _) = c +focusMaster' (W.Stack t ls rs) = W.Stack x [] (xs ++ t : rs) where (x:xs) = reverse ls |