mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 20:51:52 -07:00
nameTail - Remove the first word of a layout description
This commit is contained in:
@@ -17,9 +17,11 @@
|
|||||||
module XMonad.Layout.Named
|
module XMonad.Layout.Named
|
||||||
( -- * Usage
|
( -- * Usage
|
||||||
-- $usage
|
-- $usage
|
||||||
named
|
named,
|
||||||
|
nameTail
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import XMonad
|
||||||
import XMonad.Layout.LayoutModifier
|
import XMonad.Layout.LayoutModifier
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
@@ -30,13 +32,14 @@ import XMonad.Layout.LayoutModifier
|
|||||||
-- Then edit your @layoutHook@ by adding the Named layout modifier
|
-- Then edit your @layoutHook@ by adding the Named layout modifier
|
||||||
-- to some layout:
|
-- 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 }
|
-- > main = xmonad defaultConfig { layoutHook = myLayouts }
|
||||||
--
|
--
|
||||||
-- For more detailed instructions on editing the layoutHook see:
|
-- For more detailed instructions on editing the layoutHook see:
|
||||||
--
|
--
|
||||||
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
|
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
|
||||||
|
|
||||||
|
-- | Rename a layout.
|
||||||
named :: String -> l a -> ModifiedLayout Named l a
|
named :: String -> l a -> ModifiedLayout Named l a
|
||||||
named s = ModifiedLayout (Named s)
|
named s = ModifiedLayout (Named s)
|
||||||
|
|
||||||
@@ -44,3 +47,13 @@ data Named a = Named String deriving ( Read, Show )
|
|||||||
|
|
||||||
instance LayoutModifier Named a where
|
instance LayoutModifier Named a where
|
||||||
modifyDescription (Named n) _ = n
|
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
|
||||||
|
Reference in New Issue
Block a user