Last active
December 19, 2015 03:59
-
-
Save iquiw/5894128 to your computer and use it in GitHub Desktop.
Modified TwoPane layout. Not changing second window on mouse focus change.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Derived from xmonad-contrib/XMonad/Layout/TwoPane.hs | |
data TwoPaneMod a = TwoPaneMod Rational Rational deriving (Show, Read) | |
instance LayoutClass TwoPaneMod Window where | |
doLayout (TwoPaneMod _ split) r s = (,Nothing) <$> arrange r s | |
where | |
arrange rect st = do | |
ws <- mapped <$> get | |
let x = case reverse (W.up st) of | |
(master:_) -> [(master, left), (W.focus st, right)] | |
[] -> case win2nd ws (W.down st) of | |
(next:_) -> [(W.focus st, left), (next, right)] | |
[] -> [(W.focus st, rect)] | |
return x | |
where | |
(left, right) = splitHorizontallyBy split rect | |
win2nd ws ds = filter (`S.member` ws) ds ++ ds | |
handleMessage (TwoPaneMod delta split) x = | |
return $ case fromMessage x of | |
Just Shrink -> Just (TwoPaneMod delta (split - delta)) | |
Just Expand -> Just (TwoPaneMod delta (split + delta)) | |
_ -> Nothing | |
description _ = "TwoPaneMod" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment