xmonad-contrib-0.17.0.9: Community-maintained extensions for xmonad
Copyright(c) 2007 Andrea Rossato 2009 Jan Vornberger
LicenseBSD-style (see xmonad/LICENSE)
Maintainerandrea.rossato@unibz.it
Stabilityunstable
Portabilityunportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

XMonad.Layout.Decoration

Contents

Description

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

Synopsis

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 Source #

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 Source #

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

For a collection of Themes see XMonad.Util.Themes

Constructors

Theme 

Fields

Instances

Instances details
Read Theme Source # 
Instance details

Defined in XMonad.Layout.Decoration

Show Theme Source # 
Instance details

Defined in XMonad.Layout.Decoration

Methods

showsPrec :: Int -> Theme -> ShowS #

show :: Theme -> String #

showList :: [Theme] -> ShowS #

Default Theme Source #

The default xmonad Theme.

Instance details

Defined in XMonad.Layout.Decoration

Methods

def :: Theme #

def :: Default a => a #

The default value for this type.

data Decoration ds s a Source #

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

Instances details
(DecorationStyle ds Window, Shrinker s) => LayoutModifier (Decoration ds s) Window Source #

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 diffed 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.

Instance details

Defined in XMonad.Layout.Decoration

(Read s, Read (ds a)) => Read (Decoration ds s a) Source # 
Instance details

Defined in XMonad.Layout.Decoration

(Show s, Show (ds a)) => Show (Decoration ds s a) Source # 
Instance details

Defined in XMonad.Layout.Decoration

Methods

showsPrec :: Int -> Decoration ds s a -> ShowS #

show :: Decoration ds s a -> String #

showList :: [Decoration ds s a] -> ShowS #

newtype DecorationMsg Source #

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

Constructors

SetTheme Theme 

Instances

Instances details
Message DecorationMsg Source # 
Instance details

Defined in XMonad.Layout.Decoration

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

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.

Minimal complete definition

Nothing

Methods

describeDeco :: ds a -> String Source #

The description that the Decoration modifier will display.

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

Shrink the window's rectangle when applying a decoration.

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

The decoration event hook

decorationCatchClicksHook Source #

Arguments

:: ds a 
-> Window 
-> Int

distance from the left where the click happened on the decoration

-> Int

distance from the right where the click happened on the decoration

-> 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 () Source #

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 () Source #

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 Source #

The pure version of the main method, decorate.

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

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

Instances details
Eq a => DecorationStyle ButtonDecoration a Source # 
Instance details

Defined in XMonad.Layout.ButtonDecoration

Eq a => DecorationStyle DefaultDecoration a Source # 
Instance details

Defined in XMonad.Layout.Decoration

Eq a => DecorationStyle DwmStyle a Source # 
Instance details

Defined in XMonad.Layout.DwmStyle

Eq a => DecorationStyle ImageButtonDecoration a Source # 
Instance details

Defined in XMonad.Layout.ImageButtonDecoration

Eq a => DecorationStyle NoFrillsDecoration a Source # 
Instance details

Defined in XMonad.Layout.NoFrillsDecoration

Eq a => DecorationStyle SimpleDecoration a Source # 
Instance details

Defined in XMonad.Layout.SimpleDecoration

Eq a => DecorationStyle TabBarDecoration a Source # 
Instance details

Defined in XMonad.Layout.TabBarDecoration

Eq a => DecorationStyle TabbedDecoration a Source # 
Instance details

Defined in XMonad.Layout.Tabbed

Eq a => DecorationStyle ImageWindowSwitcherDecoration a Source # 
Instance details

Defined in XMonad.Layout.WindowSwitcherDecoration

Eq a => DecorationStyle WindowSwitcherDecoration a Source # 
Instance details

Defined in XMonad.Layout.WindowSwitcherDecoration

data DefaultDecoration a Source #

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

Constructors

DefaultDecoration 

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

Methods

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

Instances

Instances details
Shrinker CustomShrink Source # 
Instance details

Defined in XMonad.Config.Droundy

Shrinker DefaultShrinker Source # 
Instance details

Defined in XMonad.Layout.Decoration

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

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 Source #

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

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

The contrary of isVisible.

isWithin :: Rectangle -> Rectangle -> Bool Source #

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

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

Short for fromIntegral.

data DecorationState Source #

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.