aboutsummaryrefslogtreecommitdiffstats
path: root/MagicFocus.hs
blob: cfe48b7ac9ada8f22717284659ef9556d7024be4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-----------------------------------------------------------------------------
-- |
-- Module       : XMonadContrib.MagicFocus
-- Copyright    : (c) Peter De Wachter <pdewacht@gmail.com>
-- License      : BSD
--
-- Maintainer   : Peter De Wachter <pdewacht@gmail.com>
-- Stability    : unstable
-- Portability  : unportable
--
-- Automagically put the focused window in the master area.
-----------------------------------------------------------------------------

module XMonadContrib.MagicFocus (
                 -- * Usage
                 -- $usage
                 magicFocus) where

import XMonad
import StackSet

-- $usage
-- > import XMonadContrib.MagicFocus
-- > defaultLayouts = [ magicFocus tiled , magicFocus $ mirror tiled ]

magicFocus :: Layout a -> Layout a
magicFocus l = l { doLayout = \s -> (doLayout l) s . swap
                 , modifyLayout = \x -> fmap magicFocus `fmap` modifyLayout l x }

swap :: Stack a -> Stack a
swap (Stack f u d) = Stack f [] (reverse u ++ d)