aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/Named.hs
blob: 1056111fa33696287c4a6a09a846285d8cad577a (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
41
42
43
44
45
46
47
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-}

-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Layout.Named
-- Copyright   :  (c) David Roundy <droundy@darcs.net>
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  David Roundy <droundy@darcs.net>
-- Stability   :  unstable
-- Portability :  unportable
--
-- A module for assigning a name to a given layout.
--
-----------------------------------------------------------------------------

module XMonad.Layout.Named (
                                -- * Usage
                                -- $usage
                                Named(Named)
                               ) where

import XMonad

-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Layout.Named
--
-- Then edit your @layoutHook@ by adding the Named layout modifier
-- to some layout:
--
-- > myLayouts = Named "real big" Full ||| etc..
-- > main = xmonad defaultConfig { layoutHook = myLayouts }
--
-- For more detailed instructions on editing the layoutHook see:
--
-- "XMonad.Doc.Extending#Editing_the_layout_hook"

data Named l a = Named String (l a) deriving ( Read, Show )

instance (LayoutClass l a) => LayoutClass (Named l) a where
    doLayout (Named n l) r s = do (ws, ml') <- doLayout l r s
                                  return (ws, Named n `fmap` ml')
    handleMessage (Named n l) mess = do ml' <- handleMessage l mess
                                        return $ Named n `fmap` ml'
    description (Named n _) = n