aboutsummaryrefslogtreecommitdiffstats
path: root/SetLayout.hs
blob: dabb0b5fe991d9eb9af08638bc8083708dd8d425 (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
32
33
34
35
36
37
38
39
40
-----------------------------------------------------------------------------
-- |
-- Module      :  XMonadContrib.SetLayout
-- Copyright   :  (c) David Roundy <droundy@darcs.net>
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  David Roundy <droundy@darcs.net>
-- Stability   :  unstable
-- Portability :  unportable
--
-- Provides bindings to cycle through non-empty workspaces.
--
-----------------------------------------------------------------------------

module XMonadContrib.SetLayout (
                              -- * Usage
                              -- $usage
                              setLayout
                             ) where

import Graphics.X11.Xlib ( Window )
import XMonad
import StackSet hiding (filter)
import Operations

-- $usage
-- You can use this module with the following in your Config.hs file:
-- 
-- > import XMonadContrib.SetLayout
--
-- >   , ((modMask .|. shiftMask, xK_space ), setLayout $ SomeLayout $ LayoutSelection defaultLayouts) -- %! Reset this layout

-- %import XMonadContrib.SetLayout
-- %keybind , ((modMask .|. shiftMask, xK_space ), setLayout $ SomeLayout $ LayoutSelection defaultLayouts) -- %! Reset this layout

setLayout :: SomeLayout Window -> X ()
setLayout l = do sendMessage ReleaseResources
                 windows $ \s -> s { current = r $ current s }
    where r scr = scr { workspace = r' $ workspace scr }
          r' ws = ws { layout = l }