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

Contents

- Usage:
- Standard decoration settings
- Decoration-related types
- Theme types
- Widget types
- Utility functions for themes
- Convinience re-exports
- Standard widgets

Description

This set of modules contains a set of type classes and their implementations which define a flexible and extensible mechanism of window decorations.

Click here for a larger version.

Within this mechanism, there are the following entities which define how decorations will look and work:

- Main object is `DecorationEx` layout modifier. It is from where everything starts. It creates, shows and hides decoration windows (rectangles) when needed. It is parameterized with decoration geometry, decoration engine and theme. It calls these components to do their parts of the work.
- `DecorationGeometry` defines where decoration rectangles should be placed. For example, standard horizontal bar above each window; or tab bar.
- `DecorationEngine` defines how decorations look and how they react on clicks. Different implementations of the decoration engine can use different APIs to draw decorations. Within this package, there is one implementation (`TextDecoration`), which uses plain Xlib calls, and displays decoration widgets with text fragments, like `[X]` or `[_]`. Other engines can, for example, use the Cairo library to draw nice gradients and image-based widgets.
- A Decoration widget is an element placed on a window decoration. It defines how it looks and how it responds to clicks. Examples include usual window buttons (minimize, maximize, close), window icon, window title.
- A Decoration theme defines colors and fonts for the decoration engine. It also contains a list of decoration widgets and says where to place them (at the left, at the right or in the center).

This mechanism makes major use of parameterized data types and type families, in order to make it possible to define different types of decorations, and easily combine different aspects of decorations. For example, each decoration engine can be combined with each decoration geometry.

Synopsis

- decorationEx :: (DecorationEngine engine widget a, DecorationGeometry geom a, Shrinker shrinker) => shrinker -> Theme engine widget -> engine widget a -> geom a -> l a -> ModifiedLayout (DecorationEx engine widget geom shrinker) l a
- textDecoration :: Shrinker shrinker => shrinker -> Theme TextDecoration StandardWidget -> l Window -> ModifiedLayout (DecorationEx TextDecoration StandardWidget DefaultGeometry shrinker) l Window
- textTabbed :: Shrinker shrinker => shrinker -> ThemeEx StandardWidget -> l Window -> ModifiedLayout (DecorationEx TextDecoration StandardWidget TabbedGeometry shrinker) l Window
- dwmStyleDeco :: Shrinker shrinker => shrinker -> ThemeEx StandardWidget -> l Window -> ModifiedLayout (DecorationEx TextDecoration StandardWidget DwmGeometry shrinker) l Window
- data TextDecoration widget a = TextDecoration
- newtype DefaultGeometry a = DefaultGeometry {
  - gDecorationHeight :: Dimension
  }
- data TabbedGeometry a
  - = HorizontalTabs {
    - showIfSingleWindow :: !SingleTabMode
    - hTabPlacement :: !HorizontalTabPlacement
    - hTabAlignment :: !HorizontalTabsAlignment
    - hTabWidth :: !HorizontalTabWidth
    - hTabHeight :: !Dimension
    }
  - | VerticalTabs {
    - showIfSingleWindow :: !SingleTabMode
    - vTabPlacement :: !VerticalTabPlacement
    - vTabWidth :: !Dimension
    - vTabHeight :: !Dimension
    }
- data DwmGeometry a = DwmGeometry {
  - dwmShowForFocused :: !Bool
  - dwmHorizontalPosition :: !Rational
  - dwmDecoHeight :: !Dimension
  - dwmDecoWidth :: !Dimension
  }
- data DecorationEx (engine :: Type -> Type -> Type) widget (geom :: Type -> Type) shrinker a
- data BoxBorders a = BoxBorders {
  - bxTop :: !a
  - bxRight :: !a
  - bxBottom :: !a
  - bxLeft :: !a
  }
- type BorderColors = BoxBorders String
- 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
- data StandardCommand
  - = FocusWindow
  - | FocusUp
  - | FocusDown
  - | MoveToNextGroup
  - | MoveToPrevGroup
  - | DwmPromote
  - | ToggleSticky
  - | ToggleMaximize
  - | Minimize
  - | CloseWindow
  - | GridWindowMenu
- data GenericWidget cmd
  - = TitleWidget
  - | WindowIcon {
    - swCommand :: !cmd
    }
  - | GenericWidget {
    - swCheckedText :: !String
    - swUncheckedText :: !String
    - swCommand :: !cmd
    }
- type StandardWidget = GenericWidget StandardCommand
- themeEx :: Default (WidgetCommand widget) => Theme -> ThemeEx widget
- borderColor :: String -> BorderColors
- shadowBorder :: String -> String -> BorderColors
- class (Read s, Show s) => Shrinker s where
  - shrinkIt :: s -> String -> [String]
- shrinkText :: DefaultShrinker
- titleW :: StandardWidget
- toggleStickyW :: StandardWidget
- minimizeW :: StandardWidget
- maximizeW :: StandardWidget
- closeW :: StandardWidget
- dwmpromoteW :: StandardWidget
- moveToNextGroupW :: StandardWidget
- moveToPrevGroupW :: StandardWidget

# Usage:

You can use this module with the following in your `xmonad.hs`:

    import XMonad.Layout.DecorationEx

Then edit your `layoutHook` by adding the DwmStyle decoration to your layout:

    myTheme = ThemeEx {...}
    myL = textDecoration shrinkText myTheme (layoutHook def)
    main = xmonad def { layoutHook = myL }

For more detailed instructions on editing the layoutHook see:

XMonad.Doc.Extending

This module exports only some definitions from it's submodules, most likely to be used from user configurations. To define your own decoration types you will likely have to import specific submodules.

# Standard decoration settings

decorationEx #

Arguments

:: (DecorationEngine engine widget a, DecorationGeometry geom a, Shrinker shrinker) |
=> shrinker | Strings shrinker, for example `shrinkText`
-> Theme engine widget | Decoration theme
-> engine widget a | Decoration engine instance
-> geom a | Decoration geometry instance
-> l a | Underlying layout to be decorated
-> ModifiedLayout (DecorationEx engine widget geom shrinker) l a |

Apply a DecorationEx modifier to an underlying layout

textDecoration #

Arguments

:: Shrinker shrinker |
=> shrinker | String shrinker, for example `shrinkText`
-> Theme TextDecoration StandardWidget | Decoration theme (font, colors, widgets, etc)
-> l Window | Layout to be decorated
-> ModifiedLayout (DecorationEx TextDecoration StandardWidget DefaultGeometry shrinker) l Window |

Add decoration to existing layout. Widgets are indicated by text fragments, like `"[+]"`. Geometry is simple: a horizontal panel at the top of each window, going for the full width of the window.

textTabbed #

Arguments

:: Shrinker shrinker |
=> shrinker | Strings shrinker, e.g. `shrinkText`
-> ThemeEx StandardWidget | Decoration theme
-> l Window | Layout to be decorated
-> ModifiedLayout (DecorationEx TextDecoration StandardWidget TabbedGeometry shrinker) l Window |

Add tabbed decorations (with default settings) with text-based widgets to a layout.

dwmStyleDeco #

Arguments

:: Shrinker shrinker |
=> shrinker | Strings shrinker, for example `shrinkText`
-> ThemeEx StandardWidget | Decoration theme (font, colors, widgets, etc)
-> l Window | Layout to be decorated
-> ModifiedLayout (DecorationEx TextDecoration StandardWidget DwmGeometry shrinker) l Window |

Add a decoration to window layout. Widgets are indicated with text fragments using TextDecoration; decoration placement is similar to DWM.

# Decoration-related types

data TextDecoration widget a #

Decoration engine data type

Constructors

TextDecoration |

#### Instances

Instances details

(TextWidget widget, ClickHandler (GenericTheme SimpleStyle) widget) => DecorationEngine TextDecoration widget Window # |

Instance details

Defined in XMonad.Layout.DecorationEx.TextEngine

Associated Types

type Theme TextDecoration |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine type Theme TextDecoration = GenericTheme SimpleStyle
type DecorationPaintingContext TextDecoration |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine type DecorationPaintingContext TextDecoration = XPaintingContext
type DecorationEngineState TextDecoration |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine type DecorationEngineState TextDecoration = XMonadFont

Methods

describeEngine :: TextDecoration widget Window -> String #

initializeState :: TextDecoration widget Window -> geom Window -> Theme TextDecoration widget -> X (DecorationEngineState TextDecoration) #

releaseStateResources :: TextDecoration widget Window -> DecorationEngineState TextDecoration -> X () #

calcWidgetPlace :: TextDecoration widget Window -> DrawData TextDecoration widget -> widget -> X WidgetPlace #

placeWidgets :: Shrinker shrinker => TextDecoration widget Window -> Theme TextDecoration widget -> shrinker -> DecorationEngineState TextDecoration -> Rectangle -> Window -> WidgetLayout widget -> X (WidgetLayout WidgetPlace) #

getShrinkedWindowName :: Shrinker shrinker => TextDecoration widget Window -> shrinker -> DecorationEngineState TextDecoration -> String -> Dimension -> Dimension -> X String #

decorationXEventMask :: TextDecoration widget Window -> EventMask #

propsToRepaintDecoration :: TextDecoration widget Window -> X [Atom] #

decorationEventHookEx :: Shrinker shrinker => TextDecoration widget Window -> Theme TextDecoration widget -> DecorationLayoutState TextDecoration -> shrinker -> Event -> X () #

handleDecorationClick :: TextDecoration widget Window -> Theme TextDecoration widget -> Rectangle -> [Rectangle] -> Window -> Int -> Int -> Int -> X Bool #

decorationWhileDraggingHook :: TextDecoration widget Window -> CInt -> CInt -> (Window, Rectangle) -> Position -> Position -> X () #

decorationAfterDraggingHook :: TextDecoration widget Window -> (Window, Rectangle) -> Window -> X () #

paintDecoration :: Shrinker shrinker => TextDecoration widget Window -> Window -> Dimension -> Dimension -> shrinker -> DrawData TextDecoration widget -> Bool -> X () #

paintWidget :: Shrinker shrinker => TextDecoration widget Window -> DecorationPaintingContext TextDecoration -> WidgetPlace -> shrinker -> DrawData TextDecoration widget -> widget -> Bool -> X () #

Read (TextDecoration widget a) # |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine Methods readsPrec :: Int -> ReadS (TextDecoration widget a) # readList :: ReadS [TextDecoration widget a] # readPrec :: ReadPrec (TextDecoration widget a) # readListPrec :: ReadPrec [TextDecoration widget a] #
Show (TextDecoration widget a) # |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine Methods showsPrec :: Int -> TextDecoration widget a -> ShowS # show :: TextDecoration widget a -> String # showList :: [TextDecoration widget a] -> ShowS #
type DecorationEngineState TextDecoration # |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine type DecorationEngineState TextDecoration = XMonadFont
type DecorationPaintingContext TextDecoration # |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine type DecorationPaintingContext TextDecoration = XPaintingContext
type Theme TextDecoration # |
Instance details Defined in XMonad.Layout.DecorationEx.TextEngine type Theme TextDecoration = GenericTheme SimpleStyle

newtype DefaultGeometry a #

Data type for default implementation of `DecorationGeometry`. This defines simple decorations: a horizontal bar at the top of each window, running for full width of the window.

Constructors

DefaultGeometry |

Fields

- gDecorationHeight :: Dimension

#### Instances

Instances details

Eq a => DecorationGeometry DefaultGeometry a # |

Instance details

Defined in XMonad.Layout.DecorationEx.Geometry

Methods

describeGeometry :: DefaultGeometry a -> String #

shrinkWindow :: DefaultGeometry a -> Rectangle -> Rectangle -> Rectangle #

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

decorateWindow :: DefaultGeometry a -> Rectangle -> Stack a -> [(a, Rectangle)] -> (a, Rectangle) -> X (Maybe Rectangle) #

Default (DefaultGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.Geometry Methods def :: DefaultGeometry a #
Read (DefaultGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.Geometry Methods readsPrec :: Int -> ReadS (DefaultGeometry a) # readList :: ReadS [DefaultGeometry a] # readPrec :: ReadPrec (DefaultGeometry a) # readListPrec :: ReadPrec [DefaultGeometry a] #
Show (DefaultGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.Geometry Methods showsPrec :: Int -> DefaultGeometry a -> ShowS # show :: DefaultGeometry a -> String # showList :: [DefaultGeometry a] -> ShowS #

data TabbedGeometry a #

Constructors

HorizontalTabs |

Fields

- showIfSingleWindow :: !SingleTabMode

  What to do if there is only one tab

- hTabPlacement :: !HorizontalTabPlacement

  Where to place horizontal tabs

- hTabAlignment :: !HorizontalTabsAlignment

  How to align horizontal tabs (makes sense with fixed width of tabs).

- hTabWidth :: !HorizontalTabWidth

  Width of horizontal tabs

- hTabHeight :: !Dimension

  Height of horizontal tabs

VerticalTabs |

Fields

- showIfSingleWindow :: !SingleTabMode

  What to do if there is only one tab

- vTabPlacement :: !VerticalTabPlacement

  Where to place vertical tabs

- vTabWidth :: !Dimension

  Width of vertical tabs

- vTabHeight :: !Dimension

  Height of vertical tabs

#### Instances

Instances details

DecorationGeometry TabbedGeometry Window # |

Instance details

Defined in XMonad.Layout.DecorationEx.TabbedGeometry

Methods

describeGeometry :: TabbedGeometry Window -> String #

shrinkWindow :: TabbedGeometry Window -> Rectangle -> Rectangle -> Rectangle #

pureDecoration :: TabbedGeometry Window -> Rectangle -> Stack Window -> [(Window, Rectangle)] -> (Window, Rectangle) -> Maybe Rectangle #

decorateWindow :: TabbedGeometry Window -> Rectangle -> Stack Window -> [(Window, Rectangle)] -> (Window, Rectangle) -> X (Maybe Rectangle) #

Default (TabbedGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.TabbedGeometry Methods def :: TabbedGeometry a #
Read (TabbedGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.TabbedGeometry Methods readsPrec :: Int -> ReadS (TabbedGeometry a) # readList :: ReadS [TabbedGeometry a] # readPrec :: ReadPrec (TabbedGeometry a) # readListPrec :: ReadPrec [TabbedGeometry a] #
Show (TabbedGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.TabbedGeometry Methods showsPrec :: Int -> TabbedGeometry a -> ShowS # show :: TabbedGeometry a -> String # showList :: [TabbedGeometry a] -> ShowS #

data DwmGeometry a #

Decoration geometry data type

Constructors

DwmGeometry |

Fields

- dwmShowForFocused :: !Bool

  Whether to show decorations on focused windows

- dwmHorizontalPosition :: !Rational

  Horizontal position of decoration rectangle. 0 means place it at left corner, 1 - place it at right corner, `1%2` - place it at center.

- dwmDecoHeight :: !Dimension

  Height of decoration rectangle

- dwmDecoWidth :: !Dimension

  Width of decoration rectangle

#### Instances

Instances details

DecorationGeometry DwmGeometry Window # |

Instance details

Defined in XMonad.Layout.DecorationEx.DwmGeometry

Methods

describeGeometry :: DwmGeometry Window -> String #

shrinkWindow :: DwmGeometry Window -> Rectangle -> Rectangle -> Rectangle #

pureDecoration :: DwmGeometry Window -> Rectangle -> Stack Window -> [(Window, Rectangle)] -> (Window, Rectangle) -> Maybe Rectangle #

decorateWindow :: DwmGeometry Window -> Rectangle -> Stack Window -> [(Window, Rectangle)] -> (Window, Rectangle) -> X (Maybe Rectangle) #

Default (DwmGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.DwmGeometry Methods def :: DwmGeometry a #
Read (DwmGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.DwmGeometry Methods readsPrec :: Int -> ReadS (DwmGeometry a) # readList :: ReadS [DwmGeometry a] # readPrec :: ReadPrec (DwmGeometry a) # readListPrec :: ReadPrec [DwmGeometry a] #
Show (DwmGeometry a) # |
Instance details Defined in XMonad.Layout.DecorationEx.DwmGeometry Methods showsPrec :: Int -> DwmGeometry a -> ShowS # show :: DwmGeometry a -> String # showList :: [DwmGeometry a] -> ShowS #

data DecorationEx (engine :: Type -> Type -> Type) widget (geom :: Type -> Type) shrinker a #

The `DecorationEx` `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 `DecorationEngine`.

#### Instances

Instances details

(DecorationEngine engine widget Window, DecorationGeometry geom Window, Shrinker shrinker) => LayoutModifier (DecorationEx engine widget geom shrinker) Window #

The long `LayoutModifier` instance for the `DecorationEx` 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 `DecorationEx` `LayoutModifier`. Otherwise we call `handleEvent`, which will call the appropriate `DecorationEngine` methods to perform its tasks.

Instance details

Defined in XMonad.Layout.DecorationEx.LayoutModifier

Methods

modifyLayout :: LayoutClass l Window => DecorationEx engine widget geom shrinker Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X ([(Window, Rectangle)], Maybe (l Window)) #

modifyLayoutWithUpdate :: LayoutClass l Window => DecorationEx engine widget geom shrinker Window -> Workspace WorkspaceId (l Window) Window -> Rectangle -> X (([(Window, Rectangle)], Maybe (l Window)), Maybe (DecorationEx engine widget geom shrinker Window)) #

handleMess :: DecorationEx engine widget geom shrinker Window -> SomeMessage -> X (Maybe (DecorationEx engine widget geom shrinker Window)) #

handleMessOrMaybeModifyIt :: DecorationEx engine widget geom shrinker Window -> SomeMessage -> X (Maybe (Either (DecorationEx engine widget geom shrinker Window) SomeMessage)) #

pureMess :: DecorationEx engine widget geom shrinker Window -> SomeMessage -> Maybe (DecorationEx engine widget geom shrinker Window) #

redoLayout :: DecorationEx engine widget geom shrinker Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> X ([(Window, Rectangle)], Maybe (DecorationEx engine widget geom shrinker Window)) #

pureModifier :: DecorationEx engine widget geom shrinker Window -> Rectangle -> Maybe (Stack Window) -> [(Window, Rectangle)] -> ([(Window, Rectangle)], Maybe (DecorationEx engine widget geom shrinker Window)) #

hook :: DecorationEx engine widget geom shrinker Window -> X () #

unhook :: DecorationEx engine widget geom shrinker Window -> X () #

modifierDescription :: DecorationEx engine widget geom shrinker Window -> String #

modifyDescription :: LayoutClass l Window => DecorationEx engine widget geom shrinker Window -> l Window -> String #

(Read (Theme engine widget), Read shrinker, Read (engine widget a), Read (geom a)) => Read (DecorationEx engine widget geom shrinker a) # |
Instance details Defined in XMonad.Layout.DecorationEx.LayoutModifier Methods readsPrec :: Int -> ReadS (DecorationEx engine widget geom shrinker a) # readList :: ReadS [DecorationEx engine widget geom shrinker a] # readPrec :: ReadPrec (DecorationEx engine widget geom shrinker a) # readListPrec :: ReadPrec [DecorationEx engine widget geom shrinker a] #
(Show (Theme engine widget), Show shrinker, Show (engine widget a), Show (geom a)) => Show (DecorationEx engine widget geom shrinker a) # |
Instance details Defined in XMonad.Layout.DecorationEx.LayoutModifier Methods showsPrec :: Int -> DecorationEx engine widget geom shrinker a -> ShowS # show :: DecorationEx engine widget geom shrinker a -> String # showList :: [DecorationEx engine widget geom shrinker a] -> ShowS #

# Theme types

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

# Widget types

data StandardCommand #

Standard window commands.

One can extend this list by simply doing

    data MyWindowCommand =
        Std StandardCommand
      | SomeFancyCommand

    instance WindowCommand MyWindowCommand where ...

    type MyWidget = GenericWidget MyWindowCommand

Constructors

FocusWindow | Focus the window
FocusUp | Move focus to previous window
FocusDown | Move focus to following window
MoveToNextGroup | Move the window to the next group (see XMonad.Layout.Groups)
MoveToPrevGroup | Move the window to the previous group
DwmPromote | Execute `dwmpromote` (see XMonad.Actions.DwmPromote)
ToggleSticky | Make window sticky or unstick it (see XMonad.Actions.CopyWindow)
ToggleMaximize | Maximize or restore window (see XMonad.Layout.Maximize)
Minimize | Minimize window (see XMonad.Actions.Minimize)
CloseWindow | Close the window
GridWindowMenu | Show window menu via XMonad.Actions.GridSelect (see XMonad.Actions.WindowMenu)

#### Instances

Instances details

Default StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods def :: StandardCommand #
Read StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods readsPrec :: Int -> ReadS StandardCommand # readList :: ReadS [StandardCommand] # readPrec :: ReadPrec StandardCommand # readListPrec :: ReadPrec [StandardCommand] #
Show StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods showsPrec :: Int -> StandardCommand -> ShowS # show :: StandardCommand -> String # showList :: [StandardCommand] -> ShowS #
Eq StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods (==) :: StandardCommand -> StandardCommand -> Bool # (/=) :: StandardCommand -> StandardCommand -> Bool #
WindowCommand StandardCommand # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods executeWindowCommand :: StandardCommand -> Window -> X Bool # isCommandChecked :: StandardCommand -> Window -> X Bool #
TextWidget StandardWidget # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine StandardWidget -> StandardWidget -> X String #

data GenericWidget cmd #

Generic data type for decoration widgets.

Constructors

TitleWidget | Window title (just text label)
WindowIcon | Window icon with some associated command | Other widgets

Fields

- swCommand :: !cmd

  Window command

GenericWidget |

Fields

- swCheckedText :: !String

  Text for checked widget state

- swUncheckedText :: !String

  Text for unchecked widget state

- swCommand :: !cmd

  Window command

#### Instances

Instances details

TextWidget StandardWidget # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine StandardWidget -> StandardWidget -> X String #
Read cmd => Read (GenericWidget cmd) # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods readsPrec :: Int -> ReadS (GenericWidget cmd) # readList :: ReadS [GenericWidget cmd] # readPrec :: ReadPrec (GenericWidget cmd) # readListPrec :: ReadPrec [GenericWidget cmd] #
Show cmd => Show (GenericWidget cmd) # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods showsPrec :: Int -> GenericWidget cmd -> ShowS # show :: GenericWidget cmd -> String # showList :: [GenericWidget cmd] -> ShowS #
(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 #

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

type StandardWidget = GenericWidget StandardCommand #

Generic widget type specialized for `StandardCommand`

# Utility functions for themes

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 #

# Convinience re-exports

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

Methods

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

#### Instances

Instances details

Shrinker CustomShrink # |
Instance details Defined in XMonad.Config.Droundy Methods shrinkIt :: CustomShrink -> String -> [String] #
Shrinker DefaultShrinker # |
Instance details Defined in XMonad.Layout.Decoration Methods shrinkIt :: DefaultShrinker -> String -> [String] #

shrinkText :: DefaultShrinker #

# Standard widgets

titleW :: StandardWidget #

Widget for window title

toggleStickyW :: StandardWidget #

Widget for ToggleSticky command.

minimizeW :: StandardWidget #

Widget for Minimize command

maximizeW :: StandardWidget #

Widget for ToggleMaximize command

closeW :: StandardWidget #

Widget for CloseWindow command

dwmpromoteW :: StandardWidget #

moveToNextGroupW :: StandardWidget #

moveToPrevGroupW :: StandardWidget #