XMonad.Layout.DecorationEx.Common

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 #

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 #

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

Methods

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

Execute the command

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

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

#### Instances

Instances details

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

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

Type class for decoration widgets

Associated Types

type WidgetCommand widget #

Type of window commands which this type of widgets can execute

Methods

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

Get window command which is associated with this widget.

isShrinkable :: widget -> Bool #

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) # |
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) # isShrinkable :: GenericWidget cmd -> Bool #

data WidgetPlace #

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 # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods showsPrec :: Int -> WidgetPlace -> ShowS # show :: WidgetPlace -> String # showList :: [WidgetPlace] -> ShowS #

data WidgetLayout a #

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 #

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

Methods

themeWidgets :: theme widget -> WidgetLayout widget #

#### Instances

Instances details

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

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

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 #

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 #

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 # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods onDecorationClick :: GenericTheme SimpleStyle widget -> Int -> Maybe (WidgetCommand widget) # isDraggingEnabled :: GenericTheme SimpleStyle widget -> Int -> Bool #

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

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

Associated Types

type Style theme #

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

Methods

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

Select style based on window state.

widgetsPadding :: theme -> BoxBorders Dimension #

Define padding between decoration rectangle and widgets.

defaultBgColor :: theme -> String #

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

themeFontName :: theme -> String #

Font name defined in the theme.

#### Instances

Instances details

(Show widget, Read widget, Read (WidgetCommand widget), Show (WidgetCommand widget)) => ThemeAttributes (ThemeEx widget) # |
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)) # widgetsPadding :: ThemeEx widget -> BoxBorders Dimension # defaultBgColor :: ThemeEx widget -> String # themeFontName :: ThemeEx widget -> String #

type XPaintingContext = (Display, Pixmap, GC) #

Painting context for decoration engines based on plain X11 calls.

data BoxBorders a #

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

type BorderColors = BoxBorders String #

Convinience data type describing colors of decoration rectangle borders.

data ThemeStyleType #

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

Constructors

ActiveWindow |
UrgentWindow |
InactiveWindow |

#### Instances

Instances details

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

data SimpleStyle #

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 # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods readsPrec :: Int -> ReadS SimpleStyle # readList :: ReadS [SimpleStyle] # readPrec :: ReadPrec SimpleStyle # readListPrec :: ReadPrec [SimpleStyle] #
Show SimpleStyle # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods showsPrec :: Int -> SimpleStyle -> ShowS # show :: SimpleStyle -> String # showList :: [SimpleStyle] -> ShowS #
Default (WidgetCommand widget) => Default (ThemeEx widget) # |
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) # |
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)) # widgetsPadding :: ThemeEx widget -> BoxBorders Dimension # defaultBgColor :: ThemeEx widget -> String # themeFontName :: ThemeEx widget -> String #
ClickHandler (GenericTheme SimpleStyle) widget # |
Instance details Defined in XMonad.Layout.DecorationEx.Common Methods onDecorationClick :: GenericTheme SimpleStyle widget -> Int -> Maybe (WidgetCommand widget) # isDraggingEnabled :: GenericTheme SimpleStyle widget -> Int -> Bool #
type Style (ThemeEx widget) # |
Instance details Defined in XMonad.Layout.DecorationEx.Common type Style (ThemeEx widget) = SimpleStyle

data GenericTheme style widget #

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

type ThemeEx widget = GenericTheme SimpleStyle widget #

Convience type for themes used by `TextDecoration`.

# Utilities

widgetLayout :: WidgetLayout widget -> [widget] #

Utility function to convert WidgetLayout to plain list of widgets.

windowStyleType :: Window -> X ThemeStyleType #

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

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

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

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

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

borderColor :: String -> BorderColors #

shadowBorder :: String -> String -> BorderColors #