xmonad-contrib-0.18.1: Community-maintained extensions for xmonad

Copyright | (c) 2007 Andrea Rossato 2009 Jan Vornberger 2023 Ilya Portnov
License | BSD-style (see xmonad/LICENSE)
Maintainer | portnov84@rambler.ru
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell2010

XMonad.Layout.DecorationEx.Common

Contents

- Common types
- Utilities

Description

This module exposes a number of types which are used by other sub-modules of XMonad.Layout.DecorationEx module.

Synopsis

- data WindowDecoration = WindowDecoration {
  - wdOrigWindow :: !Window
  - wdOrigWinRect :: !Rectangle
  - wdDecoWindow :: !(Maybe Window)
  - wdDecoRect :: !(Maybe Rectangle)
  - wdWidgets :: ![WidgetPlace]
  }
- class (Read cmd, Show cmd) => WindowCommand cmd where
  - executeWindowCommand :: cmd -> Window -> X Bool
  - isCommandChecked :: cmd -> Window -> X Bool
- class (WindowCommand (WidgetCommand widget), Read widget, Show widget) => DecorationWidget widget where
  - type WidgetCommand widget
  - widgetCommand :: widget -> Int -> WidgetCommand widget
  - isShrinkable :: widget -> Bool
- data WidgetPlace = WidgetPlace {
  - wpTextYPosition :: !Position
  - wpRectangle :: !Rectangle
  }
- data WidgetLayout a = WidgetLayout {
  - wlLeft :: ![a]
  - wlCenter :: ![a]
  - wlRight :: ![a]
  }
- class HasWidgets (theme :: Type -> Type) widget where
  - themeWidgets :: theme widget -> WidgetLayout widget
- class ClickHandler (theme :: Type -> Type) widget where
  - onDecorationClick :: theme widget -> Int -> Maybe (WidgetCommand widget)
  - isDraggingEnabled :: theme widget -> Int -> Bool
- class (Read theme, Show theme) => ThemeAttributes theme where
  - type Style theme
  - selectWindowStyle :: theme -> Window -> X (Style theme)
  - widgetsPadding :: theme -> BoxBorders Dimension
  - defaultBgColor :: theme -> String
  - themeFontName :: theme -> String
- type XPaintingContext = (Display, Pixmap, GC)
- data BoxBorders a = BoxBorders {
  - bxTop :: !a
  - bxRight :: !a
  - bxBottom :: !a
  - bxLeft :: !a
  }
- type BorderColors = BoxBorders String
- data ThemeStyleType
  - = ActiveWindow
  - | UrgentWindow
  - | InactiveWindow
- data SimpleStyle = SimpleStyle {
  - sBgColor :: !String
  - sTextColor :: !String
  - sTextBgColor :: !String
  - sDecoBorderWidth :: !Dimension
  - sDecorationBorders :: !BorderColors
  }
- data GenericTheme style widget = GenericTheme {
  - exActive :: !style
  - exInactive :: !style
  - exUrgent :: !style
  - exPadding :: !(BoxBorders Dimension)
  - exFontName :: !String
  - exOnDecoClick :: !(Map Int (WidgetCommand widget))
  - exDragWindowButtons :: ![Int]
  - exWidgetsLeft :: ![widget]
  - exWidgetsCenter :: ![widget]
  - exWidgetsRight :: ![widget]
  }
- type ThemeEx widget = GenericTheme SimpleStyle widget
- widgetLayout :: WidgetLayout widget -> [widget]
- windowStyleType :: Window -> X ThemeStyleType
- genericWindowStyle :: Window -> GenericTheme style widget -> X style
- themeEx :: Default (WidgetCommand widget) => Theme -> ThemeEx widget
- borderColor :: String -> BorderColors
- shadowBorder :: String -> String -> BorderColors

# Common types

data WindowDecoration Source #

Information about decoration of one window

Constructors

WindowDecoration |

Fields

- wdOrigWindow :: !Window

  Original window (one being decorated)

- wdOrigWinRect :: !Rectangle

  Rectangle of original window

- wdDecoWindow :: !(Maybe Window)

  Decoration window, or Nothing if this window should not be decorated

- wdDecoRect :: !(Maybe Rectangle)

  Rectangle for decoration window

- wdWidgets :: ![WidgetPlace]

  Places for widgets

class (Read cmd, Show cmd) => WindowCommand cmd where Source #

Type class for window commands (such as maximize or close window)

Methods

executeWindowCommand :: cmd -> Window -> X Bool Source #

Execute the command

isCommandChecked :: cmd -> Window -> X Bool Source #

Is the command currently in `checked` state. For example, for `sticky` command, check if the window is currently sticky.

#### Instances

Instances details

WindowCommand StandardCommand Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods executeWindowCommand :: StandardCommand -> Window -> X Bool Source # isCommandChecked :: StandardCommand -> Window -> X Bool Source #

class (WindowCommand (WidgetCommand widget), Read widget, Show widget) => DecorationWidget widget where Source #

Type class for decoration widgets

Associated Types

type WidgetCommand widget Source #

Type of window commands which this type of widgets can execute

Methods

widgetCommand :: widget -> Int -> WidgetCommand widget Source #

Get window command which is associated with this widget.

isShrinkable :: widget -> Bool Source #

Check if the widget is shrinkable, i.e. if it's width can be reduced if there is not enough place in the decoration.

#### Instances

Instances details

(Default cmd, Read cmd, Show cmd, WindowCommand cmd) => DecorationWidget (GenericWidget cmd) Source # |

Instance details

Defined in XMonad.Layout.DecorationEx.Widgets

Associated Types

type WidgetCommand (GenericWidget cmd) |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets type WidgetCommand (GenericWidget cmd) = cmd

Methods

widgetCommand :: GenericWidget cmd -> Int -> WidgetCommand (GenericWidget cmd) Source #

isShrinkable :: GenericWidget cmd -> Bool Source #

data WidgetPlace Source #

Data type describing where the decoration widget (e.g. window button) should be placed. All coordinates are relative to decoration rectangle.

Constructors

WidgetPlace |

Fields

- wpTextYPosition :: !Position

  Y position of text base line (for widgets like window title or text-based buttons)

- wpRectangle :: !Rectangle

  Rectangle where to place the widget

#### Instances

Instances details

Show WidgetPlace Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods showsPrec :: Int -> WidgetPlace -> ShowS Source # show :: WidgetPlace -> String Source # showList :: [WidgetPlace] -> ShowS Source #

data WidgetLayout a Source #

Layout of widgets

Constructors

WidgetLayout |

Fields

- wlLeft :: ![a]

  Widgets that should be aligned to the left side of decoration

- wlCenter :: ![a]

  Widgets that should be in the center of decoration

- wlRight :: ![a]

  Widgets taht should be aligned to the right side of decoration

class HasWidgets (theme :: Type -> Type) widget where Source #

Type class for themes, which claims that the theme contains the list of widgets and their alignments.

Methods

themeWidgets :: theme widget -> WidgetLayout widget Source #

#### Instances

Instances details

HasWidgets (GenericTheme style) widget Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods themeWidgets :: GenericTheme style widget -> WidgetLayout widget Source #

class ClickHandler (theme :: Type -> Type) widget where Source #

Type class for themes, which claims that the theme can describe how the decoration should respond to clicks on decoration itself (between widgets).

Methods

onDecorationClick Source #

Arguments

:: theme widget |
-> Int | Mouse button number
-> Maybe (WidgetCommand widget) |

This is called when the user clicks on the decoration rectangle (not on one of widgets).

isDraggingEnabled Source #

Arguments

:: theme widget |
-> Int | Mouse button number
-> Bool |

Determine if it is possible to drag window by it's decoration with mouse button.

#### Instances

Instances details

ClickHandler (GenericTheme SimpleStyle) widget Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods onDecorationClick :: GenericTheme SimpleStyle widget -> Int -> Maybe (WidgetCommand widget) Source # isDraggingEnabled :: GenericTheme SimpleStyle widget -> Int -> Bool Source #

class (Read theme, Show theme) => ThemeAttributes theme where Source #

Type class for themes, which claims that the theme is responsible for determining looks of decoration.

Associated Types

type Style theme Source #

Type which describes looks of decoration in one of window states (active, inactive, urgent, etc).

Methods

selectWindowStyle :: theme -> Window -> X (Style theme) Source #

Select style based on window state.

widgetsPadding :: theme -> BoxBorders Dimension Source #

Define padding between decoration rectangle and widgets.

defaultBgColor :: theme -> String Source #

Initial background color of decoration rectangle. When decoration widget is created, it is initially filled with this color.

themeFontName :: theme -> String Source #

Font name defined in the theme.

#### Instances

Instances details

(Show widget, Read widget, Read (WidgetCommand widget), Show (WidgetCommand widget)) => ThemeAttributes (ThemeEx widget) Source # |

Instance details

Defined in XMonad.Layout.DecorationEx.Common

Associated Types

type Style (ThemeEx widget) |
Instance details Defined in XMonad.Layout.DecorationEx.Common type Style (ThemeEx widget) = SimpleStyle

Methods

selectWindowStyle :: ThemeEx widget -> Window -> X (Style (ThemeEx widget)) Source #

widgetsPadding :: ThemeEx widget -> BoxBorders Dimension Source #

defaultBgColor :: ThemeEx widget -> String Source #

themeFontName :: ThemeEx widget -> String Source #

type XPaintingContext = (Display, Pixmap, GC) Source #

Painting context for decoration engines based on plain X11 calls.

data BoxBorders a Source #

Generic data type which is used to describe characteristics of rectangle borders.

Constructors

BoxBorders |

Fields

- bxTop :: !a
- bxRight :: !a
- bxBottom :: !a
- bxLeft :: !a

#### Instances

Instances details

Read a => Read (BoxBorders a) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods readsPrec :: Int -> ReadS (BoxBorders a) Source # readList :: ReadS [BoxBorders a] Source # readPrec :: ReadPrec (BoxBorders a) Source # readListPrec :: ReadPrec [BoxBorders a] Source #
Show a => Show (BoxBorders a) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods showsPrec :: Int -> BoxBorders a -> ShowS Source # show :: BoxBorders a -> String Source # showList :: [BoxBorders a] -> ShowS Source #
Eq a => Eq (BoxBorders a) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods (==) :: BoxBorders a -> BoxBorders a -> Bool Source # (/=) :: BoxBorders a -> BoxBorders a -> Bool Source #

type BorderColors = BoxBorders String Source #

Convinience data type describing colors of decoration rectangle borders.

data ThemeStyleType Source #

Supported states of windows (on which looks of decorations can depend).

Constructors

ActiveWindow |
UrgentWindow |
InactiveWindow |

#### Instances

Instances details

Read ThemeStyleType Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods readsPrec :: Int -> ReadS ThemeStyleType Source # readList :: ReadS [ThemeStyleType] Source # readPrec :: ReadPrec ThemeStyleType Source # readListPrec :: ReadPrec [ThemeStyleType] Source #
Show ThemeStyleType Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods showsPrec :: Int -> ThemeStyleType -> ShowS Source # show :: ThemeStyleType -> String Source # showList :: [ThemeStyleType] -> ShowS Source #
Eq ThemeStyleType Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods (==) :: ThemeStyleType -> ThemeStyleType -> Bool Source # (/=) :: ThemeStyleType -> ThemeStyleType -> Bool Source #

data SimpleStyle Source #

Data type describing look of window decoration in particular state (active or inactive)

Constructors

SimpleStyle |

Fields

- sBgColor :: !String

  Decoration background color

- sTextColor :: !String

  Text (foreground) color

- sTextBgColor :: !String

  Text background color

- sDecoBorderWidth :: !Dimension

  Width of border of decoration rectangle. Set to 0 to disable the border.

- sDecorationBorders :: !BorderColors

  Colors of borders of decoration rectangle.

#### Instances

Instances details

Read SimpleStyle Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods readsPrec :: Int -> ReadS SimpleStyle Source # readList :: ReadS [SimpleStyle] Source # readPrec :: ReadPrec SimpleStyle Source # readListPrec :: ReadPrec [SimpleStyle] Source #
Show SimpleStyle Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods showsPrec :: Int -> SimpleStyle -> ShowS Source # show :: SimpleStyle -> String Source # showList :: [SimpleStyle] -> ShowS Source #
Default (WidgetCommand widget) => Default (ThemeEx widget) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods def :: ThemeEx widget #
(Show widget, Read widget, Read (WidgetCommand widget), Show (WidgetCommand widget)) => ThemeAttributes (ThemeEx widget) Source # |

Instance details

Defined in XMonad.Layout.DecorationEx.Common

Associated Types

type Style (ThemeEx widget) |
Instance details Defined in XMonad.Layout.DecorationEx.Common type Style (ThemeEx widget) = SimpleStyle

Methods

selectWindowStyle :: ThemeEx widget -> Window -> X (Style (ThemeEx widget)) Source #

widgetsPadding :: ThemeEx widget -> BoxBorders Dimension Source #

defaultBgColor :: ThemeEx widget -> String Source #

themeFontName :: ThemeEx widget -> String Source #

ClickHandler (GenericTheme SimpleStyle) widget Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods onDecorationClick :: GenericTheme SimpleStyle widget -> Int -> Maybe (WidgetCommand widget) Source # isDraggingEnabled :: GenericTheme SimpleStyle widget -> Int -> Bool Source #
type Style (ThemeEx widget) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common type Style (ThemeEx widget) = SimpleStyle

data GenericTheme style widget Source #

Generic Theme data type. This is used by `TextEngine` and can be used by other relatively simple decoration engines.

Constructors

GenericTheme |

Fields

- exActive :: !style

  Decoration style for active (focused) windows

- exInactive :: !style

  Decoration style for inactive (unfocused) windows

- exUrgent :: !style

  Decoration style for urgent windows

- exPadding :: !(BoxBorders Dimension)

  Padding between decoration rectangle and widgets

- exFontName :: !String

  Font name

- exOnDecoClick :: !(Map Int (WidgetCommand widget))

  Correspondence between mouse button number and window command.

- exDragWindowButtons :: ![Int]

  For which mouse buttons dragging is enabled

- exWidgetsLeft :: ![widget]

  Widgets that should appear at the left of decoration rectangle (listed left to right)

- exWidgetsCenter :: ![widget]

  Widgets that should appear in the center of decoration rectangle (listed left to right)

- exWidgetsRight :: ![widget]

  Widgets that should appear at the right of decoration rectangle (listed left to right)

#### Instances

Instances details

Default (WidgetCommand widget) => Default (ThemeEx widget) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods def :: ThemeEx widget #
(Show widget, Read widget, Read (WidgetCommand widget), Show (WidgetCommand widget)) => ThemeAttributes (ThemeEx widget) Source # |

Instance details

Defined in XMonad.Layout.DecorationEx.Common

Associated Types

type Style (ThemeEx widget) |
Instance details Defined in XMonad.Layout.DecorationEx.Common type Style (ThemeEx widget) = SimpleStyle

Methods

selectWindowStyle :: ThemeEx widget -> Window -> X (Style (ThemeEx widget)) Source #

widgetsPadding :: ThemeEx widget -> BoxBorders Dimension Source #

defaultBgColor :: ThemeEx widget -> String Source #

themeFontName :: ThemeEx widget -> String Source #

ClickHandler (GenericTheme SimpleStyle) widget Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods onDecorationClick :: GenericTheme SimpleStyle widget -> Int -> Maybe (WidgetCommand widget) Source # isDraggingEnabled :: GenericTheme SimpleStyle widget -> Int -> Bool Source #
HasWidgets (GenericTheme style) widget Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods themeWidgets :: GenericTheme style widget -> WidgetLayout widget Source #
(Read widget, Read (WidgetCommand widget), Read style) => Read (GenericTheme style widget) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods readsPrec :: Int -> ReadS (GenericTheme style widget) Source # readList :: ReadS [GenericTheme style widget] Source # readPrec :: ReadPrec (GenericTheme style widget) Source # readListPrec :: ReadPrec [GenericTheme style widget] Source #
(Show widget, Show (WidgetCommand widget), Show style) => Show (GenericTheme style widget) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods showsPrec :: Int -> GenericTheme style widget -> ShowS Source # show :: GenericTheme style widget -> String Source # showList :: [GenericTheme style widget] -> ShowS Source #
type Style (ThemeEx widget) Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Common type Style (ThemeEx widget) = SimpleStyle

type ThemeEx widget = GenericTheme SimpleStyle widget Source #

Convience type for themes used by `TextDecoration`.

# Utilities

widgetLayout :: WidgetLayout widget -> [widget] Source #

Utility function to convert WidgetLayout to plain list of widgets.

windowStyleType :: Window -> X ThemeStyleType Source #

Detect type of style to be used from current state of the window.

genericWindowStyle :: Window -> GenericTheme style widget -> X style Source #

Generic utility function to select style from `GenericTheme` based on current state of the window.

themeEx :: Default (WidgetCommand widget) => Theme -> ThemeEx widget Source #

Convert Theme type from XMonad.Layout.Decoration to theme type used by XMonad.Layout.DecorationEx.TextEngine.

borderColor :: String -> BorderColors Source #

shadowBorder :: String -> String -> BorderColors Source #