Skip to content

Instantly share code, notes, and snippets.

@iquiw
Last active December 19, 2015 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iquiw/5894128 to your computer and use it in GitHub Desktop.
Save iquiw/5894128 to your computer and use it in GitHub Desktop.
Modified TwoPane layout. Not changing second window on mouse focus change.
-- 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