nameTail - Remove the first word of a layout description

This commit is contained in:
Anders Engstrom
2009-05-03 10:59:50 +00:00
parent 4a8c4b74ac
commit 561855133c

View File

@@ -17,9 +17,11 @@
module XMonad.Layout.Named
( -- * Usage
-- $usage
named
named,
nameTail
) where
import XMonad
import XMonad.Layout.LayoutModifier
-- $usage
@@ -30,13 +32,14 @@ import XMonad.Layout.LayoutModifier
-- Then edit your @layoutHook@ by adding the Named layout modifier
-- to some layout:
--
-- > myLayouts = named "real big" Full ||| etc..
-- > myLayouts = named "real big" Full ||| (nameTail $ 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"
-- | Rename a layout.
named :: String -> l a -> ModifiedLayout Named l a
named s = ModifiedLayout (Named s)
@@ -44,3 +47,13 @@ data Named a = Named String deriving ( Read, Show )
instance LayoutModifier Named a where
modifyDescription (Named n) _ = n
-- | Remove the first word of the name.
nameTail :: l a -> ModifiedLayout NameTail l a
nameTail = ModifiedLayout NameTail
data NameTail a = NameTail deriving (Read,Show)
instance LayoutModifier NameTail a where
modifyDescription NameTail i = dropWhile (==' ') $ dropWhile (/=' ') $ description i