xmonad-contrib-0.13: Third party extensions for xmonad

Copyright | (c) 2007 Andrea Rossato, 2009 Jan Vornberger
License | BSD-style (see xmonad/LICENSE)
Maintainer | andrea.rossato@unibz.it
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Layout.Decoration

Contents

- Usage:

Description

A layout modifier and a class for easily creating decorated layouts.

Synopsis

- decoration :: (DecorationStyle ds a, Shrinker s) => s -> Theme -> ds a -> l a -> ModifiedLayout (Decoration ds s) l a
- data Theme = Theme {
  - activeColor :: String
  - inactiveColor :: String
  - urgentColor :: String
  - activeBorderColor :: String
  - inactiveBorderColor :: String
  - urgentBorderColor :: String
  - activeTextColor :: String
  - inactiveTextColor :: String
  - urgentTextColor :: String
  - fontName :: String
  - decoWidth :: Dimension
  - decoHeight :: Dimension
  - windowTitleAddons :: [(String, Align)]
  - windowTitleIcons :: [([[Bool]], Placement)]
  }
- defaultTheme :: Theme
- def :: Default a => a
- data Decoration ds s a
- data DecorationMsg = SetTheme Theme
- class (Read (ds a), Show (ds a), Eq a) => DecorationStyle ds a where
- data DefaultDecoration a = DefaultDecoration
- class (Read s, Show s) => Shrinker s where
- data DefaultShrinker
- shrinkText :: DefaultShrinker
- data CustomShrink = CustomShrink
- shrinkWhile :: (String -> [String]) -> (String -> X Bool) -> String -> X String
- isInStack :: Eq a => Stack a -> a -> Bool
- isVisible :: Rectangle -> [Rectangle] -> Bool
- isInvisible :: Rectangle -> [Rectangle] -> Bool
- isWithin :: Rectangle -> Rectangle -> Bool
- fi :: (Integral a, Num b) => a -> b
- findWindowByDecoration :: Window -> DecorationState -> Maybe (OrigWin, (Window, Maybe Rectangle))
- module XMonad.Layout.LayoutModifier
- data DecorationState
- type OrigWin = (Window, Rectangle)

# Usage:

This module is intended for layout developers, who want to decorate their layouts. End users will not find here very much for them.

For examples of `DecorationStyle` instances you can have a look at XMonad.Layout.SimpleDecoration, XMonad.Layout.Tabbed, XMonad.Layout.DwmStyle, or XMonad.Layout.TabBarDecoration.

decoration :: (DecorationStyle ds a, Shrinker s) => s -> Theme -> ds a -> l a -> ModifiedLayout (Decoration ds s) l a #

A layout modifier that, with a `Shrinker`, a `Theme`, a `DecorationStyle`, and a layout, will decorate this layout according to the decoration style provided.

For some usage examples see XMonad.Layout.DecorationMadness.

data Theme #

A `Theme` is a record of colors, font etc., to customize a `DecorationStyle`.

For a collection of `Theme`s see XMonad.Util.Themes

Constructors

Theme |
Fields activeColor :: String Color of the active window inactiveColor :: String Color of the inactive window urgentColor :: String Color of the urgent window activeBorderColor :: String Color of the border of the active window inactiveBorderColor :: String Color of the border of the inactive window urgentBorderColor :: String Color of the border of the urgent window activeTextColor :: String Color of the text of the active window inactiveTextColor :: String Color of the text of the inactive window urgentTextColor :: String Color of the text of the urgent window fontName :: String Font name decoWidth :: Dimension Maximum width of the decorations (if supported by the `DecorationStyle`) decoHeight :: Dimension Height of the decorations windowTitleAddons :: [(String, Align)] Extra text to appear in a window's title bar. Refer to for a use XMonad.Layout.ImageButtonDecoration windowTitleIcons :: [([[Bool]], Placement)] Extra icons to appear in a window's title bar. Inner `[Bool]` is a row in a icon bitmap.

Instances

Read Theme # |
Methods readsPrec :: Int -> ReadS Theme # readList :: ReadS [Theme] # readPrec :: ReadPrec Theme # readListPrec :: ReadPrec [Theme] #
Show Theme # |
Methods showsPrec :: Int -> Theme -> ShowS # show :: Theme -> String # showList :: [Theme] -> ShowS #
Default Theme # |
Methods def :: Theme #

defaultTheme :: Theme #

Deprecated: Use def (from Data.Default, and re-exported by XMonad.Layout.Decoration) instead.

The default xmonad `Theme`.

def :: Default a => a #

The default value for this type.

data Decoration ds s a #

The `Decoration` `LayoutModifier`. This data type is an instance of the `LayoutModifier` class. This data type will be passed, together with a layout, to the `ModifiedLayout` type constructor to modify the layout by adding decorations according to a `DecorationStyle`.

Instances

(DecorationStyle ds Window, Shrinker s) => LayoutModifier (Decoration ds s) Window # | The long `LayoutModifier` instance for the `Decoration` type. In `redoLayout` we check the state: if there is no state we initialize it. The state is `diff`ed against the list of windows produced by the underlying layout: removed windows get deleted and new ones decorated by `createDecos`, which will call `decorate` to decide if a window must be given a `Rectangle`, in which case a decoration window will be created. After that we resync the updated state with the windows' list and then we process the resynced stated (as we do with a new state). First we map the decoration windows, we update each decoration to reflect any decorated window's change, and we insert, in the list of windows and rectangles returned by the underlying layout, the decoration for each window. This way xmonad will restack the decorations and their windows accordingly. At the end we remove invisible/stacked windows. Message handling is quite simple: when needed we release the state component of the `Decoration` `LayoutModifier`. Otherwise we call `handleEvent`, which will call the appropriate `DecorationStyle` methods to perform its tasks.
Methods modifyLayout :: LayoutClass l Window => Decoration ds s Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (l Window)) # modifyLayoutWithUpdate :: LayoutClass l Window => Decoration ds s Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X (([(Window, Rectangle)], Maybe (l Window)), Maybe (Decoration ds s Window)) # handleMess :: Decoration ds s Window -> SomeMessage -> X (Maybe (Decoration ds s Window)) # handleMessOrMaybeModifyIt :: Decoration ds s Window -> SomeMessage -> X (Maybe (Either (Decoration ds s Window) SomeMessage)) # pureMess :: Decoration ds s Window -> SomeMessage -> Maybe (Decoration ds s Window) # redoLayout :: Decoration ds s Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe (Decoration ds s Window)) # pureModifier :: Decoration ds s Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> ([(Window, Rectangle)], Maybe (Decoration ds s Window)) # hook :: Decoration ds s Window -> X () # unhook :: Decoration ds s Window -> X () # modifierDescription :: Decoration ds s Window -> String # modifyDescription :: LayoutClass l Window => Decoration ds s Window -> l Window -> String #
(Read s, Read (ds a)) => Read (Decoration ds s a) # |
Methods readsPrec :: Int -> ReadS (Decoration ds s a) # readList :: ReadS [Decoration ds s a] # readPrec :: ReadPrec (Decoration ds s a) # readListPrec :: ReadPrec [Decoration ds s a] #
(Show s, Show (ds a)) => Show (Decoration ds s a) # |
Methods showsPrec :: Int -> Decoration ds s a -> ShowS # show :: Decoration ds s a -> String # showList :: [Decoration ds s a] -> ShowS #

data DecorationMsg #

A `Decoration` layout modifier will handle `SetTheme`, a message to dynamically change the decoration `Theme`.

Constructors

SetTheme Theme |

Instances

Message DecorationMsg # |

class (Read (ds a), Show (ds a), Eq a) => DecorationStyle ds a where #

The `DecorationStyle` class, defines methods used in the implementation of the `Decoration` `LayoutModifier` instance. A type instance of this class is passed to the `Decoration` type in order to decorate a layout, by using these methods.

Methods

describeDeco :: ds a -> String #

The description that the `Decoration` modifier will display.

shrink :: ds a -> Rectangle -> Rectangle -> Rectangle #

Shrink the window's rectangle when applying a decoration.

decorationEventHook :: ds a -> DecorationState -> Event -> X () #

The decoration event hook

decorationCatchClicksHook :: ds a -> Window -> Int -> Int -> X Bool #

A hook that can be used to catch the cases when the user clicks on the decoration. If you return True here, the click event will be considered as dealt with and no further processing will take place.

decorationWhileDraggingHook :: ds a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () #

This hook is called while a window is dragged using the decoration. The hook can be overwritten if a different way of handling the dragging is required.

decorationAfterDraggingHook :: ds a -> (Window, Rectangle) -> Window -> X () #

This hoook is called after a window has been dragged using the decoration.

pureDecoration :: ds a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle #

The pure version of the main method, `decorate`.

decorate :: ds a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #

Given the theme's decoration width and height, the screen rectangle, the windows stack, the list of windows and rectangles returned by the underlying layout and window to be decorated, tupled with its rectangle, produce a `Just` `Rectangle` or `Nothing` if the window is not to be decorated.

Instances

Eq a => DecorationStyle DefaultDecoration a # |
Methods describeDeco :: DefaultDecoration a -> String # shrink :: DefaultDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: DefaultDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: DefaultDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: DefaultDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: DefaultDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: DefaultDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: DefaultDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle DwmStyle a # |
Methods describeDeco :: DwmStyle a -> String # shrink :: DwmStyle a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: DwmStyle a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: DwmStyle a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: DwmStyle a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: DwmStyle a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: DwmStyle a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: DwmStyle a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle SimpleDecoration a # |
Methods describeDeco :: SimpleDecoration a -> String # shrink :: SimpleDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: SimpleDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: SimpleDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: SimpleDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: SimpleDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: SimpleDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: SimpleDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle NoFrillsDecoration a # |
Methods describeDeco :: NoFrillsDecoration a -> String # shrink :: NoFrillsDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: NoFrillsDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: NoFrillsDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: NoFrillsDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: NoFrillsDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: NoFrillsDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: NoFrillsDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle TabBarDecoration a # |
Methods describeDeco :: TabBarDecoration a -> String # shrink :: TabBarDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: TabBarDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: TabBarDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: TabBarDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: TabBarDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: TabBarDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: TabBarDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle TabbedDecoration a # |
Methods describeDeco :: TabbedDecoration a -> String # shrink :: TabbedDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: TabbedDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: TabbedDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: TabbedDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: TabbedDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: TabbedDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: TabbedDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle ButtonDecoration a # |
Methods describeDeco :: ButtonDecoration a -> String # shrink :: ButtonDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: ButtonDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: ButtonDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: ButtonDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: ButtonDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: ButtonDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: ButtonDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle ImageButtonDecoration a # |
Methods describeDeco :: ImageButtonDecoration a -> String # shrink :: ImageButtonDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: ImageButtonDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: ImageButtonDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: ImageButtonDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: ImageButtonDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: ImageButtonDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: ImageButtonDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle ImageWindowSwitcherDecoration a # |
Methods describeDeco :: ImageWindowSwitcherDecoration a -> String # shrink :: ImageWindowSwitcherDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: ImageWindowSwitcherDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: ImageWindowSwitcherDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: ImageWindowSwitcherDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: ImageWindowSwitcherDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: ImageWindowSwitcherDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: ImageWindowSwitcherDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Eq a => DecorationStyle WindowSwitcherDecoration a # |
Methods describeDeco :: WindowSwitcherDecoration a -> String # shrink :: WindowSwitcherDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: WindowSwitcherDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: WindowSwitcherDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: WindowSwitcherDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: WindowSwitcherDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: WindowSwitcherDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: WindowSwitcherDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #

data DefaultDecoration a #

The default `DecorationStyle`, with just the default methods' implementations.

Constructors

DefaultDecoration |

Instances

Eq a => DecorationStyle DefaultDecoration a # |
Methods describeDeco :: DefaultDecoration a -> String # shrink :: DefaultDecoration a -> Rectangle -> Rectangle -> Rectangle # decorationEventHook :: DefaultDecoration a -> DecorationState -> Event -> X () # decorationCatchClicksHook :: DefaultDecoration a -> Window -> Int -> Int -> X Bool # decorationWhileDraggingHook :: DefaultDecoration a -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () # decorationAfterDraggingHook :: DefaultDecoration a -> (Window, Rectangle) -> Window -> X () # pureDecoration :: DefaultDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> Maybe Rectangle # decorate :: DefaultDecoration a -> Dimension -> Dimension -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #
Read (DefaultDecoration a) # |
Methods readsPrec :: Int -> ReadS (DefaultDecoration a) # readList :: ReadS [DefaultDecoration a] # readPrec :: ReadPrec (DefaultDecoration a) # readListPrec :: ReadPrec [DefaultDecoration a] #
Show (DefaultDecoration a) # |
Methods showsPrec :: Int -> DefaultDecoration a -> ShowS # show :: DefaultDecoration a -> String # showList :: [DefaultDecoration a] -> ShowS #

class (Read s, Show s) => Shrinker s where #

Minimal complete definition

shrinkIt

Methods

shrinkIt :: s -> String -> [String] #

Instances

Shrinker DefaultShrinker # |
Methods shrinkIt :: DefaultShrinker -> String -> [String] #

data DefaultShrinker #

Instances

Read DefaultShrinker # |
Methods readsPrec :: Int -> ReadS DefaultShrinker # readList :: ReadS [DefaultShrinker] # readPrec :: ReadPrec DefaultShrinker # readListPrec :: ReadPrec [DefaultShrinker] #
Show DefaultShrinker # |
Methods showsPrec :: Int -> DefaultShrinker -> ShowS # show :: DefaultShrinker -> String # showList :: [DefaultShrinker] -> ShowS #
Shrinker DefaultShrinker # |
Methods shrinkIt :: DefaultShrinker -> String -> [String] #

shrinkText :: DefaultShrinker #

data CustomShrink #

Constructors

CustomShrink |

Instances

Read CustomShrink # |
Methods readsPrec :: Int -> ReadS CustomShrink # readList :: ReadS [CustomShrink] # readPrec :: ReadPrec CustomShrink # readListPrec :: ReadPrec [CustomShrink] #
Show CustomShrink # |
Methods showsPrec :: Int -> CustomShrink -> ShowS # show :: CustomShrink -> String # showList :: [CustomShrink] -> ShowS #

shrinkWhile :: (String -> [String]) -> (String -> X Bool) -> String -> X String #

isInStack :: Eq a => Stack a -> a -> Bool #

True if the window is in the `Stack`. The `Window` comes second to facilitate list processing, even though `w `isInStack` s` won't work...;)

isVisible :: Rectangle -> [Rectangle] -> Bool #

Given a `Rectangle` and a list of `Rectangle`s is True if the `Rectangle` is not completely contained by any `Rectangle` of the list.

isInvisible :: Rectangle -> [Rectangle] -> Bool #

The contrary of `isVisible`.

isWithin :: Rectangle -> Rectangle -> Bool #

True is the first `Rectangle` is totally within the second `Rectangle`.

fi :: (Integral a, Num b) => a -> b #

Short-hand for `fromIntegral`

findWindowByDecoration :: Window -> DecorationState -> Maybe (OrigWin, (Window, Maybe Rectangle)) #

module XMonad.Layout.LayoutModifier

data DecorationState #

The `Decoration` state component, where the list of decorated window's is zipped with a list of decoration. A list of decoration is a list of tuples, a `Maybe` `Window` and a 'Maybe Rectangle'. The `Window` will be displayed only if the rectangle is of type `Just`.

type OrigWin = (Window, Rectangle) #