diff options
author | Adam Vogt <vogt.adam@gmail.com> | 2010-10-30 02:06:20 +0200 |
---|---|---|
committer | Adam Vogt <vogt.adam@gmail.com> | 2010-10-30 02:06:20 +0200 |
commit | 3f2754a8708b81c0f2b25cadb7024e6ca130292e (patch) | |
tree | c97ca69808a0c9c0ecefa2d9e65734b858d36295 | |
parent | d0cc1c1150a7623cb74521512ec4bd3d37f22c67 (diff) | |
download | XMonadContrib-3f2754a8708b81c0f2b25cadb7024e6ca130292e.tar.gz XMonadContrib-3f2754a8708b81c0f2b25cadb7024e6ca130292e.tar.xz XMonadContrib-3f2754a8708b81c0f2b25cadb7024e6ca130292e.zip |
Fix bug in L.TrackFloating
Ignore-this: 2c3902ea9f1d70a7043965c8aa99891d
Addresses the comment that:
If the focus goes from the floating layer to tiling by deleting a floating
window, it's again the master window that gets focus, not the remembered
window.
darcs-hash:20101030000620-1499c-fedd38718bbcaaac77dae90f13aae2c5f66fa6a0.gz
-rw-r--r-- | XMonad/Layout/TrackFloating.hs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/XMonad/Layout/TrackFloating.hs b/XMonad/Layout/TrackFloating.hs index 6c54817..615141a 100644 --- a/XMonad/Layout/TrackFloating.hs +++ b/XMonad/Layout/TrackFloating.hs @@ -29,6 +29,7 @@ module XMonad.Layout.TrackFloating import Control.Monad import Data.List +import Data.Maybe import qualified Data.Map as M import XMonad @@ -36,19 +37,22 @@ import XMonad.Layout.LayoutModifier import qualified XMonad.StackSet as W -data TrackFloating a = TrackFloating (Maybe Window) - deriving (Read,Show) +data TrackFloating a = TrackFloating + { _wasFloating :: Bool, + _tiledFocus :: Maybe Window } + deriving (Read,Show,Eq) instance LayoutModifier TrackFloating Window where - modifyLayoutWithUpdate (TrackFloating mw) ws@(W.Workspace{ W.stack = ms }) r + modifyLayoutWithUpdate os@(TrackFloating wasF mw) ws@(W.Workspace{ W.stack = ms }) r = do winset <- gets windowset - let sTotal = W.stack $ W.workspace $ W.current winset + let sCur = fmap W.focus $ W.stack $ W.workspace $ W.current winset + isF = fmap (`M.member` W.floating winset) sCur newStack -- focus is floating, so use the remembered focus point - | Just sTotal' <- sTotal, - W.focus sTotal' `M.member` W.floating winset, + | Just isF' <- isF, + isF' || wasF, Just w <- mw, Just s <- ms, Just ns <- find ((==) w . W.focus) @@ -56,15 +60,14 @@ instance LayoutModifier TrackFloating Window where = Just ns | otherwise = ms - newState - | Just sTotal' <- sTotal - = if W.focus sTotal' `M.member` W.floating winset - then mw - else Just (W.focus sTotal') - | otherwise - = Nothing + newState = case isF of + Just True -> mw + Just False | Just f <- sCur -> Just f + _ -> Nothing ran <- runLayout ws{ W.stack = newStack } r - return (ran, guard (newState /= mw) >> Just (TrackFloating newState)) + return (ran, + let n = TrackFloating (fromMaybe False isF) newState + in guard (n /= os) >> Just n) {- | Apply to your layout in a config like: @@ -79,5 +82,5 @@ Interactions with some layout modifiers (ex. decorations, minimizing) are unknown but likely unpleasant. -} trackFloating :: l a -> ModifiedLayout TrackFloating l a -trackFloating layout = ModifiedLayout (TrackFloating Nothing) layout +trackFloating layout = ModifiedLayout (TrackFloating False Nothing) layout |