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

Copyright | 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.Widgets

Contents

- Data types
- Utility functions
- Presets for standard widgets

Description

This module contains data types and utilities to deal with decoration widgets. A widget is anything that is displayed on window decoration, and, optionally, can react on clicks. Examples of widgets are usual window buttons (minimize, maximize, close), window icon and window title.

Synopsis

- data StandardCommand
  - = FocusWindow
  - | FocusUp
  - | FocusDown
  - | MoveToNextGroup
  - | MoveToPrevGroup
  - | DwmPromote
  - | ToggleSticky
  - | ToggleMaximize
  - | Minimize
  - | CloseWindow
  - | GridWindowMenu
- class DecorationWidget widget => TextWidget widget where
  - widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine widget -> widget -> X String
- data GenericWidget cmd
  - = TitleWidget
  - | WindowIcon {
    - swCommand :: !cmd
    }
  - | GenericWidget {
    - swCheckedText :: !String
    - swUncheckedText :: !String
    - swCommand :: !cmd
    }
- type StandardWidget = GenericWidget StandardCommand
- isWidgetChecked :: DecorationWidget widget => widget -> Window -> X Bool
- titleW :: StandardWidget
- toggleStickyW :: StandardWidget
- minimizeW :: StandardWidget
- maximizeW :: StandardWidget
- closeW :: StandardWidget
- dwmpromoteW :: StandardWidget
- moveToNextGroupW :: StandardWidget
- moveToPrevGroupW :: StandardWidget

# Data types

data StandardCommand Source #

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

class DecorationWidget widget => TextWidget widget where Source #

Type class for widgets that can be displayed as text fragments by `TextDecoration` engine.

Methods

widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine widget -> widget -> X String Source #

#### Instances

Instances details

TextWidget StandardWidget Source # |
Instance details Defined in XMonad.Layout.DecorationEx.Widgets Methods widgetString :: forall (engine :: Type -> Type -> Type). DrawData engine StandardWidget -> StandardWidget -> X String Source #

data GenericWidget cmd Source #

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

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

type StandardWidget = GenericWidget StandardCommand Source #

Generic widget type specialized for `StandardCommand`

# Utility functions

isWidgetChecked :: DecorationWidget widget => widget -> Window -> X Bool Source #

Check if the widget should be displayed in `checked` state.

# Presets for standard widgets

titleW :: StandardWidget Source #

Widget for window title

toggleStickyW :: StandardWidget Source #

Widget for ToggleSticky command.

minimizeW :: StandardWidget Source #

Widget for Minimize command

maximizeW :: StandardWidget Source #

Widget for ToggleMaximize command

closeW :: StandardWidget Source #

Widget for CloseWindow command

dwmpromoteW :: StandardWidget Source #

moveToNextGroupW :: StandardWidget Source #

moveToPrevGroupW :: StandardWidget Source #